fac2dummies: Transform a factor variable to dummy variables.
Description
Convert a factor variable with n levels to n dummy variables.
Usage
fac2dummies(GADSdat, var)
Value
Returns a GADSdat containing the newly computed variables.
Arguments
GADSdat
A data.frame or GADSdat object.
var
A character vector with the name of the factor variable.
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.