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"))

