factor_to_dummy.Rd
Create a dummy matrix based on the elements of a factor. Each column in the produced matrix is a dummy indicator.
factor_to_dummy(afactor)
a factor (preferably of vectors)
A matrix of dummy variables
# let's say you have a list like this
some_factor = iris$Species[c(1:3,51:53,101:103)]
# get dummy matrix
factor_to_dummy(some_factor)
#> setosa versicolor virginica
#> 1 1 0 0
#> 2 1 0 0
#> 3 1 0 0
#> 4 0 1 0
#> 5 0 1 0
#> 6 0 1 0
#> 7 0 0 1
#> 8 0 0 1
#> 9 0 0 1