unmatrix                package:gdata                R Documentation

_C_o_n_v_e_r_t _a _m_a_t_r_i_x _i_n_t_o _a _v_e_c_t_o_r, _w_i_t_h _a_p_p_r_o_p_r_i_a_t_e _n_a_m_e_s

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

     Convert a matrix into a vector, with element names constructed
     from the row and column names of the matrix.

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

     unmatrix(x, byrow=FALSE)

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

       x: matrix

   byrow: Logical. If 'FALSE', the elements within columns will be
          adjacent in the resulting vector, otherwise elements within
          rows will be adjacent.

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

     A vector with names constructed from the row and column names from
     the matrix. If the the row or column names are missing, ('r1',
     'r2', ..,) or ('c1', 'c2', ..) will be used as appropriate.

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

     Gregory R. Warnes gregory.r.warnes@pfizer.com

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

     'as.vector'

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

     # simple, useless example
     m <- matrix( letters[1:10], ncol=5)
     m
     unmatrix(m)

     # unroll model output
     x <- rnorm(100)
     y <- rnorm(100, mean=3+5*x, sd=0.25)
     m <- coef( summary(lm( y ~ x )) )
     unmatrix(m)

