Learn R Programming

GDAtools (version 2.1)

dichotomixed: Dichotomizes the factor variables in a mixed format data frame

Description

Dichotomizes the factor variables in a data frame composed of mixed format variables, i.e. transforms the factors into an indicator matrix (also known as disjunctive table) and keeps the numerical variables.

Usage

dichotomixed(data, out = "numeric")

Value

Returns a data frame with numerical variables and dichotomized factor variables

Arguments

data

data frame of categorical and numerical variables

out

character string defining the format for dichotomized variables in the output data frame. Format may be "numeric" (default) or "factor".

Author

Nicolas Robette

Examples

Run this code
## Dichotomizes Music example data frame
data(Music)
## recodes Age as numerical, for the sake of the example
Music$Age <- as.numeric(Music$Age)
## dichotomization
dic <- dichotomixed(Music)
str(dic)

Run the code above in your browser using DataLab