Description Usage Arguments Value Author(s) See Also Examples
tvctovmat
creates an object of class, tvcov
, from a list of
matrices with timevarying or intraindividual covariates for each
individual or one matrix or dataframe of such covariate values. It can
also combine two such objects or add interactions among covariates.
Such objects can be printed. Methods are available for extracting the
covariates and their names: covariates
and
names
. The method,
transform
, can transform variables in place or
by adding new variables to the object.
1 2 
tvcov 
Either (1) if unbalanced, a list of matrices or
dataframes with timevarying or intraindividual covariate values for
each individual (one column per variable), (2) if balanced, one matrix
or dataframe of such covariate values (when there is only one such
covariate) with dimensions: number of individuals by number of
observations/individual, or (3) an object of class, 
names 
The names of the timevarying or intraindividual
covariates in 
units 
Optional character vector specifying units of measurements of covariates. 
interaction 
A pair of index numbers or names of variables in

ccov 
Timeconstant or interindividual covariates for which an
interaction is to be introduced with timevarying or intraindividual
covariates in 
oldtvcov 
An object of class, 
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. 
Returns an object of class, tvcov
, containing a matrix or
dataframe for the covariates (z$tvcov
) with one row per
response per individual and a vector giving the number of observations
per individual (z$nobs
).
J.K. Lindsey
DataMethods
, covariates
,
description
, formula
,
gettvc
, lvna
,
names
, restovec
,
rmna
, tcctomat
,
transform
, units
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  z < matrix(rpois(20,5),ncol=5)
print(tvc < tvctomat(z, units="days"))
covariates(tvc)
names(tvc)
v < data.frame(matrix(rep(c("a","b","c","d","e"),4),ncol=5))
print(tvc2 < tvctomat(v, oldtvc=tvc, units=NA))
covariates(tvc2)
print(tvc3 < tvctomat(v, oldtvc=tvc, dataframe=FALSE, units=NA))
covariates(tvc3)
print(tvc4 < tvctomat(tvc2, interaction=c("z","v")))
covariates(tvc4)
x1 < 1:4
x2 < gl(4,1)
xx < tcctomat(data.frame(x1,x2), dataframe=FALSE)
tvctomat(tvc3, interaction="z", ccov=xx)
tvctomat(tvc3, interaction="z", ccov=xx, names="x1")
tvctomat(tvc3, interaction="z", ccov=xx, names=c("x22","x23","x24"))
xx < tcctomat(data.frame(x1,x2), dataframe=TRUE)
tvctomat(tvc2, interaction="z", ccov=xx)
tvctomat(tvc2, interaction="z", ccov=xx, names="x1")
tvctomat(tvc2, interaction="z", ccov=xx, names="x2")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.