Convert a factor variable with n levels to n dummy variables.
Details
Newly created variables are named as the original variable with the suffix "_a"
, "_b"
and so on. Variable labels
are created by using the original variable label (if available) and adding the value label of the corresponding level.
All missing codes are forwarded to all dummy variables.
Examples
## create an example GADSdat
suppressMessages(gads <- import_DF(iris))
## transform factor variable
gads2 <- fac2dummies(gads, var = "Species")
#> The following dummy variables have been created: Species_a, Species_b, Species_c