factor_to_dummy {turner} | R Documentation |
Create a dummy matrix from the elements in a factor
Description
Create a dummy matrix based on the elements of a factor. Each column in the produced matrix is a dummy indicator.
Usage
factor_to_dummy(afactor)
Arguments
afactor |
a factor (preferably of vectors) |
Value
A matrix of dummy variables
Author(s)
Gaston Sanchez
See Also
vector_to_dummy
,
list_to_dummy
Examples
# 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)
[Package turner version 0.1.9 Index]