Learn R Programming

sjPlot (version 1.7)

dicho: Dichotomize variables

Description

Dichotomizes variables into dummy variables (0/1). Dichotomization is either done by median, mean or a specific value (see dichBy).

Usage

dicho(var, dichBy = "median", dichVal = -1, asNum = FALSE)

Arguments

Value

A dichotomized factor (or numeric, if asNum = TRUE) variable (0/1-coded).

Examples

Run this code
data(efc)
summary(efc$c12hour)
table(dicho(efc$c12hour))
table(dicho(efc$c12hour, "mean"))
table(dicho(efc$c12hour, "value", 30))

Run the code above in your browser using DataLab