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)
A vector of character factor levels or the number of unique levels.
This argument is for backwards compatibility and only the
default of TRUE
is supported.
This argument is for backwards compatibility and only the
default of FALSE
is supported.
A diagonal matrix that is n
-by-n
.