dichotomixed {GDAtools}R Documentation

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")

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".

Value

Returns a data frame with numerical variables and dichotomized factor variables

Author(s)

Nicolas Robette

Examples

## 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)

[Package GDAtools version 2.1 Index]