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]))
       }

