reshapeWide               package:base               R Documentation

_R_e_s_h_a_p_e _d_a_t_a _f_r_a_m_e _t_o _w_i_d_e _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
     long format, 1 row per observation to wide format with repeated
     observations in multiple variables across rows.

_U_s_a_g_e:

     reshapeWide(x, i=reshape.i, j=reshape.j,
                 val=reshape.v, jnames=levels(j))

_A_r_g_u_m_e_n_t_s:

       x: The data frame to convert

       i: Factor or numeric. Indicates observations in same row of the
          wide format

       j: Factor or numeric. Indicates observations in same column of
          wide format

     val: Value to reshape for.

  jnames: Names of new variables in reshaped frame

_D_e_t_a_i_l_s:

     `val', `i', and `j' are interpreted relative to `x'. This
     essentially places the values of `val' in a table defined by `i'
     and `j', which are assumed to span the data set (exactly one
     observation in each cell of their cross-tabulation). Any other
     variables in the data frame will be assumed to have the same value
     for all values of `j' (given `i') and are collapsed into a single
     value.

_V_a_l_u_e:

     The reshaped data frame.

_W_A_R_N_I_N_G:

     There is no check that the names given to the new columns are
     valid identifiers or unique within the data frame. Variables in
     `x' are not checked to have constant values given `i'.

_B_u_g_s:

     There ought to be a way to have multiple `val' variables.

_N_o_t_e:

     The defaults are set to use the names that result from a call to
     `reshapeLong'.

_S_e_e _A_l_s_o:

     `reshapeLong', `unstack'

_E_x_a_m_p_l_e_s:

     dd<-as.data.frame(matrix(1:24,4))
     (dd1<-reshapeLong(dd,V3:V5))
     reshapeWide(dd1)
     reshapeWide(dd1,jnames=c("A","B","C"))

