dummy {micsr} | R Documentation |
Transform a factor in a set of dummy variables
Description
The normal way to store cathegorical variables in R is to use factors, each modality being a level of this factor. Sometimes however, is is more convenient to use a set of dummy variables.
Usage
dummy(x, ..., keep = FALSE, prefix = NULL, ref = FALSE)
Arguments
x |
a data frame |
... |
series of the data frame, should be factors |
keep |
a boolean, if |
prefix |
an optional prefix for the names of the computed dummies, |
ref |
a boolean, if |
Value
a data frame
Examples
charitable %>% dummy(religion, education)
[Package micsr version 0.1-1 Index]