dummy: Table of dummy variables

View source: R/dummy.R

dummyR Documentation

Table of dummy variables

Description

Build a table of dummy variables from a qualitative variable. A binary variable (i.e. 0/1) is created for each level of the qualitative variable.

Usage

dummy(Y)

Arguments

Y

A vector representing a qualitative variable.

Value

A matrix of dummy variables (i.e. binary variables), each representing a given level of the qualitative variable.

Examples


y <- c(1, 1, 3, 2, 3)
dummy(y)

y <- c("B", "a", "B")
dummy(y)


mlesnoff/rnirs documentation built on April 24, 2023, 4:17 a.m.