powered by
One-hot encode a factor variable
one_hot(labels)
integer
Integer vector of encoded labels.
factor Factor to encode.
factor
if (FALSE) { one_hot(factor(c("a", "b", "a"))) }
Run the code above in your browser using DataLab