powered by
Converts a factor into a binary matrix with as many columns as categories of the factor.
FactorToBinary(y, Name = NULL)
A factor.
Name to use in the final matrix.
An indicator binary matrix.
# NOT RUN { y=factor(c(1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1)) FactorToBinary(y) # }
Run the code above in your browser using DataLab