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)

