modelMatrix
takes in a data.frame and encodes it as a sparse model.Matrix object.
Factors use treatment ("one-hot") encoding, creating indicator variables from categorical
and binary variables.
Note that names of categorical variables will change slightly
(n-1 unique values appended to name)
1 | modelMatrix(x, interactions = FALSE, intercept = FALSE)
|
x |
A data.frame with finite, non-missing elements. |
interactions |
Logical; if |
intercept |
Logcal; if |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.