balancedGrouped             package:nlme             R Documentation

_C_r_e_a_t_e _a _g_r_o_u_p_e_d_D_a_t_a _o_b_j_e_c_t _f_r_o_m _a _m_a_t_r_i_x

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

     Create a 'groupedData' object from a data matrix.  This function
     can be used only with balanced data.  The opposite conversion,
     from a 'groupedData' object to a 'matrix', is done with 'asTable'.

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

     balancedGrouped(form, data, labels=NULL, units=NULL)

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

    form: A formula of the form 'y ~ x | g' giving the name of the
          response, the primary covariate, and the grouping factor.

    data: A matrix or data frame containing the values of the response
          grouped according to the levels of the grouping factor (rows)
          and the distinct levels of the primary covariate (columns).
          The 'dimnames' of the matrix are used to construct the levels
          of the grouping factor and the primary covariate.

  labels: an optional list of character strings giving labels for the
          response and the primary covariate.  The label for the
          primary covariate is named 'x' and that for the response is
          named 'y'.  Either label can be omitted.

   units: an optional list of character strings giving the units for
          the response and the primary covariate.  The units string for
          the primary covariate is named 'x' and that for the response
          is named 'y'.  Either units string can be omitted.

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

     A balanced 'groupedData' object.

_A_u_t_h_o_r(_s):

     Jose Pinheiro Jose.Pinheiro@pharma.novartis.com and Douglas Bates
     bates@stat.wisc.edu

_S_e_e _A_l_s_o:

     'groupedData', 'isBalanced', 'asTable'

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

     OrthoMat <- asTable( Orthodont )
     Orth2 <- balancedGrouped(distance ~ age | Subject, data = OrthoMat,
         labels = list(x = "Age",
                       y = "Distance from pituitary to pterygomaxillary fissure"),
         units = list(x = "(yr)", y = "(mm)"))
     Orth2[ 1:10, ]        ## check the first few entries

