dummy | R Documentation |
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.
dummy(y)
y |
A qualitative variable. |
A matrix of dummy variables (i.e. binary variables), each representing a given level of the qualitative variable.
y <- c(1, 1, 3, 2, 3)
dummy(y)
y <- c("B", "a", "B")
dummy(y)
dummy(as.factor(y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.