Converts a Factor into its indicator matrix
Converts a factor into a binary matrix with as many columns as categories of the factor
Factor2Binary(y, Name = NULL)
y
: A factorName
: Name to use in the final matrixAn indicator binary matrix
Jose Luis Vicente Villardon
y=factor(c(1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1)) Factor2Binary(y)
Useful links