reshapeLong               package:base               R Documentation

_R_e_s_h_a_p_e _d_a_t_a _f_r_a_m_e _t_o _l_o_n_g _f_o_r_m_a_t

_D_e_s_c_r_i_p_t_i_o_n:

     (EXPERIMENTAL). Convert data frame with repeated measurements in
     wide format with repeated observations in multiple variables
     across rows to long format, 1 row per observation.

_U_s_a_g_e:

     reshapeLong(x, jvars, ilev=row.names(x), jlev=names(x)[jvars],
                 iname="reshape.i", jname="reshape.j", vname="reshape.v")

_A_r_g_u_m_e_n_t_s:

       x: The data frame to convert

   jvars: The variables to reshape by

    ilev: Levels of 1st indexing factor

    jlev: Levels of 2nd indexing factor

   iname: Name of 1st indexing factor

   jname: Name of 2nd indexing factor 

   vname: Name of variable holding the combined values of the "across"
          variables

_D_e_t_a_i_l_s:

     This causes the values in `jvars' to be combined into a single
     variable, all other variables being replicated the relevant number
     of times. Two factors are added to the data frame indicating rows
     and columns of the original data format.

_V_a_l_u_e:

     The reshaped data frame.

_B_u_g_s:

     There ought to be a way to have multiple sets of `jvars'
     variables.

_N_o_t_e:

     The same substitution tricks are used for `jvars' as for the
     `select' argument to `subset'. I.e. the argument is treated as an
     expression and variables are replaced with their number in the
     data frame, allowing ranges of variables to be specified.

_S_e_e _A_l_s_o:

     `reshapeWide', `stack'

_E_x_a_m_p_l_e_s:

     (dd<-as.data.frame(matrix(1:24,4)))
     reshapeLong(dd,V3:V5)

