one_hot | R Documentation |
This replicates model.matrix()
but with one-hot encoding
for unordered factors. Ordered factors use the default contrasts (as
set in options("contrasts")
. By default, the first column of the model matrix
(the intercept) is removed.
one_hot(formula, data, intercept = FALSE)
formula |
A model formula passed to |
data |
A data frame passed to |
intercept |
If |
The contrast function used is contrast_one_hot()
.
A matrix (as from model.matrix()
).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.