orderFeatures            package:hddplot            R Documentation

_O_r_d_e_r _f_e_a_t_u_r_e_s, _b_a_s_e_d _o_n _t_h_e_i_r _a_b_i_l_i_t_y _t_o _d_i_s_c_r_i_m_i_n_a_t_e

_D_e_s_c_r_i_p_t_i_o_n:

     For each row of 'data', an F or (potentially) other statistic is
     calculated, using the function 'FUN', that measures the extent to
     which this variable separates the data into groups. This statistic
     is then used to order the rows.

_U_s_a_g_e:

      orderFeatures(x, cl, subset = NULL, FUN = aovFbyrow, values =
     FALSE) 

_A_r_g_u_m_e_n_t_s:

       x: Matrix; rows are features, and columns are observations 
          ('samples')

      cl: Factor that classifies columns into groups

  subset: allows specification of a subset of the columns of 'data'

     FUN: specifies the function used to measure separation between
          groups

  values: if 'TRUE', F-values as well as the ordering are returned

_D_e_t_a_i_l_s:

_V_a_l_u_e:

     Either ('values=FALSE') a vector that orders the rows, or
     ('values=TRUE') 

     ord: a vector that orders the rows

    stat: ordered values of the statistic

_N_o_t_e:

_A_u_t_h_o_r(_s):

     John Maindonald

_R_e_f_e_r_e_n_c_e_s:

_S_e_e _A_l_s_o:

     ~~objects to See Also as 'help', ~~~

_E_x_a_m_p_l_e_s:

     mat <- matrix(rnorm(1000), ncol=20)
     cl <- factor(rep(1:3, c(7,9,4)))
     ord <- orderFeatures(mat, cl)

     ## The function is currently defined as
     function(x, cl, subset=NULL, FUN=aovFbyrow, values=FALSE){
         if(dim(x)[2]!=length(cl))stop(paste("Dimension 2 of x is",
                       dim(x)[2], "differs from the length of cl (=",
                       length(cl)))
         ## Ensure that cl is a factor & has no redundant levels
         if(is.null(subset))
           cl <- factor(cl)
         else
           cl <- factor(cl[subset])
         if(is.null(subset))
           stat <- FUN(x, cl)
         else
           stat <- FUN(x[, subset], cl)
         ord <- order(-abs(stat))
         if(!values)ord else(list(ord=ord, stat=stat[ord]))
       }

