as.array               package:memisc               R Documentation

_C_o_n_v_e_r_t_i_n_g _D_a_t_a _F_r_a_m_e_s _i_n_t_o _A_r_r_a_y_s

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

     The 'as.array' for data frames takes all factors in a data frame
     and uses them to define the dimensions of the resulting array, and
     fills the array with the values of the remaining numeric
     variables.

     Currently, the data frame must contain all combinations of factor
     levels.

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

     ## S4 method for signature 'data.frame':
     as.array(x,data.name=NULL,...)

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

       x: a data frame

data.name: a character string, giving the name attached to the
          dimension that corresponds to the numerical variables in the
          data frame (that is, the 'name' attached to the corresponding
          element of the 'dimnames' list). 

     ...: other arguments, ignored.

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

     An array

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

     BerkeleyAdmissions <- to.data.frame(UCBAdmissions)
     BerkeleyAdmissions
     as.array(BerkeleyAdmissions,data.name="Admit")
     try(as.array(BerkeleyAdmissions[-1,],data.name="Admit"))

