Contrast function for one-hot encodings
This contrast function produces a model matrix that has indicator columns for each level of each factor.
contr_one_hot(n, contrasts = TRUE, sparse = FALSE)
n |
A vector of character factor levels or the number of unique levels. |
contrasts |
This argument is for backwards compatibility and only the
default of |
sparse |
This argument is for backwards compatibility and only the
default of |
A diagonal matrix that is n
-by-n
.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.