dummy {rchemo} | R Documentation |
Table of dummy variables
Description
The function builds a table of dummy variables from a qualitative variable. A binary (i.e. 0/1) variable is created for each level of the qualitative variable.
Usage
dummy(y)
Arguments
y |
A qualitative variable. |
Value
Y |
A matrix of dummy variables (i.e. binary variables), each representing a given level of the qualitative variable. |
lev |
levels of the qualitative variable. |
ni |
number of observations per level of the qualitative variable. |
Examples
y <- c(1, 1, 3, 2, 3)
dummy(y)
y <- c("B", "a", "B")
dummy(y)
dummy(as.factor(y))
[Package rchemo version 0.1-2 Index]