tcctomat               package:rmutil               R Documentation

_C_r_e_a_t_e _a _T_i_m_e-_c_o_n_s_t_a_n_t, _I_n_t_e_r-_i_n_d_i_v_i_d_u_a_l _C_o_v_a_r_i_a_t_e (_t_c_c_o_v) _O_b_j_e_c_t

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

     'tcctomat' creates an object of class, 'tccov', from a vector or
     matrix containing time-constant or inter-individual baseline
     covariates or a model formula. It can also combine two such
     objects.

     Such objects can be printed. Methods are available for extracting
     the covariates, their names, and the formula: 'covariates',
     'names', and 'formula'. The method, 'transform', can transform
     variables in place or by adding new variables to the object.

     To obtain the indexing to expand time-constant or inter-individual
     covariates to the size of a repeated measurements response, use
     'covind'.

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

     tcctomat(ccov, names=NULL, units=NULL, oldccov=NULL, dataframe=TRUE,
             description=NULL)

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

    ccov: A vector, matrix, or dataframe containing time-constant or
          inter-individual baseline covariates with one row per
          individual, a model formula using vectors of the same size,
          or an object of class, 'tccov'. In the first two cases, the
          variables may be factors; if 'dataframe=FALSE', these are
          transformed to indicator variables.

   units: Optional character vector specifying units of measurements of
          covariates.

   names: The names of the covariates (if the matrix does not have
          column names).

 oldccov: An object of class, 'tccov', to which 'ccov' is to be added.

dataframe: If TRUE and factor variables are present, the covariates are
          stored as a dataframe; if FALSE, they are expanded to
          indicator variables. If no factor variables are present,
          covariates are always stored as a matrix.

description: An optional named list of character vectors with names of
          some or all covariates containing their descriptions.

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

     Returns an object of class, 'tccov', containing one matrix or
     dataframe for the covariates ('z$ccov') with one row per
     individual and possibly the model formula ('z$linear').

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

     J.K. Lindsey

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

     'DataMethods', 'covariates', 'description', 'formula', 'lvna',
     'names', 'restovec', 'rmna', 'transform', 'tvctomat', 'units'

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

     x1 <- gl(4,1)
     print(tcc1 <- tcctomat(~x1))
     covariates(tcc1)
     covariates(tcc1, name="x12")
     tcctomat(x1)
     tcctomat(x1, dataframe=FALSE)
     x2 <- c(0,0,1,1)
     print(tcc2 <- tcctomat(~x2, units="days"))
     covariates(tcc2)
     print(tcc3 <- tcctomat(~x1+x2))
     covariates(tcc3)
     covariates(tcc3, names=c("x12","x2"))
     formula(tcc3)
     names(tcc3)
     print(tcc4 <- tcctomat(data.frame(x1,x2), units=c(NA,"days")))
     covariates(tcc4)
     print(tcc5 <- tcctomat(data.frame(x1,x2), dataframe=FALSE, units=c(NA,"days")))
     covariates(tcc5)

