Creates a design matrix.
design.matrix(a, name = "X", remove.collinear = TRUE, include.intercept = TRUE)
Object from which to create a design matrix. Can be a vector, matrix, factor, or dataframe.
Name of the design matrix. Used to name columns that aren't already named (e.g. X1, X2, etc.)
Will remove columns that are collinear, to ensure the design matrix is full rank.
Add an intercept to the matrix if one is not included already.
A matrix.
Numerical vectors are not modified. Factors are converted to dummy variables. Character vectors are converted to factors, and then to dummy variables.