matrix2raw               package:pheno               R Documentation

_C_o_n_v_e_r_t_s _n_u_m_e_r_i_c _m_a_t_r_i_x _t_o _d_a_t_a _f_r_a_m_e

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

     Converts a numeric matrix M into a dataframe D with three columns
     (x, factor 1, factor 2) where rows of M are ranks of factor 1
     levels and columns of M are ranks of factor 2 levels, missing
     values are set to 0.

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

     matrix2raw(M,l1,l2)

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

       M: Numeric matrix

      l1: *Optional* numeric vector of level names of column 2 (factor
          1) of returned data frame. If missing it is assigned row
          numbers of 'M'.

      l2: *Optional* numeric vector of level names of column 3 (factor
          2) of returned data frame. If missing it is assigned column
          numbers of 'M'.

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

       D: Data frame with three columns: (y,f1,f1). 'y': observations,
          i.e. non-zero entries, in matrix. 'f1': factor 1, i.e. row
          number of M or 'l1'. 'f2': factor 2, i.e. column number of M
          or 'l2'. D is ordered first by factor 2 and then factor 1.

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

     Joerg Schaber

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

             data(DWD)
             M <- raw2matrix(DWD)    # conversion to matrix
             D1 <- matrix2raw(M)     # back conversion, but with different level names
             D2 <- matrix2raw(M,c(1951:1998),c(1:9)) # with original level names

