dichotom: Dichotomizes the variables in a data frame
Description
Dichotomizes the variables in a data frame exclusively composed of categorical variables, i.e. transforms the data into an indicator matrix (also known as disjunctive table)
Usage
dichotom(data, out = "numeric")
Value
Returns a data frame with dichotomized variables. The number of columns is equal to the total number of categories in the input data.
Arguments
data
data frame of categorical variables
out
character string defining the format for dichotomized variables in the output data frame.
Format may be "numeric" (default) or "factor".
## Dichotomizes Music example data framedata(Music)
dic <- dichotom(Music[,1:5])
str(dic)
## with output variables in factor formatdic <- dichotom(Music[,1:5], out='factor')
str(dic)