

tcctomat(rmutil)                             R Documentation

_C_r_e_a_t_e _o_r _a_d_d _t_o _a _t_i_m_e_-_c_o_n_s_t_a_n_t _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 baseline
     covariates or a model formula, or combines two such
     objects.

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

     To obtain the indexing to expand time-constant covari-
     ates to the size of a repeated measurements response,
     use `covind'.

_U_s_a_g_e_:

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

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

    ccov: A vector or matrix containing time-constant base-
          line covariates with one row per individual, a
          model formula using vectors of the same size, or
          an object of class, tccov.

   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.

_V_a_l_u_e_:

     Returns an object of class, tccov, containing one
     matrix 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_:

     `read.list', `restovec', `rmna', `transform', `tvc-
     tomat'.

_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=T)
     x2 <- c(0,0,1,1)
     print(tcc2 <- tcctomat(~x2))
     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)))
     covariates(tcc4)
     print(tcc5 <- tcctomat(data.frame(x1,x2), dataframe=T))
     covariates(tcc5)

