Learn R Programming

rigr (version 1.0.7)

dummy: Create Dummy Variables

Description

Create Dummy Variables

Usage

dummy(
  x,
  subset = rep(TRUE, length(x)),
  reference = sort(unique(x[!is.na(x)])),
  includeAll = FALSE
)

Value

A matrix containing the dummy variables.

Arguments

x

y variable used to create the dummy variables.

subset

cluster a subset of the data, if desired.

reference

the reference value for the dummy variables to compare to.

includeAll

logical value indicating whether all of the dummy variables should be returned (including the reference).

Examples

Run this code

data(mri)

# Create a dummy variable for chd
dummy(mri$chd)

Run the code above in your browser using DataLab