dummy: Create Dummy Variables

View source: R/dummy.R

dummyR Documentation

Create Dummy Variables

Description

Create Dummy Variables

Usage

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

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

Value

A matrix containing the dummy variables.

Examples


data(mri)

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


rigr documentation built on Sept. 7, 2022, 1:05 a.m.