model_matrix {mcmcsae} | R Documentation |
Compute possibly sparse model matrix
Description
Compute possibly sparse model matrix
Usage
model_matrix(
formula,
data = NULL,
contrasts.arg = NULL,
drop.unused.levels = FALSE,
sparse = NULL,
drop0 = TRUE,
catsep = "",
by = NULL,
tabM = FALSE,
enclos = .GlobalEnv
)
Arguments
formula |
model formula. |
data |
data frame containing all variables used in |
contrasts.arg |
specification of contrasts for factor variables. Currently supported are "contr.none" (no contrasts applied), "contr.treatment" (first level removed) and "contr.SAS" (last level removed). Alternatively, a named list specifying a single level per factor variable can be passed. |
drop.unused.levels |
whether empty levels of individual factor variables should be removed. |
sparse |
if |
drop0 |
whether to drop any remaining explicit zeros in resulting sparse matrix. |
catsep |
separator for concatenating factor variable names and level names.
By default it is the empty string, reproducing the labels of |
by |
a vector by which to aggregate the result. |
tabM |
if |
enclos |
enclosure to look for objects not found in |
Value
Design matrix X, either an ordinary matrix or a sparse dgCMatrix
.