powered by
Stacks up in columns the values of all the binary variables that can be associated with different levels of a categorical variable.
binaries(x)
A categorical variable (either numeric or character).
A set of binary vectors, each having the value 1 for a unique level of x.
The name of each new variable is of the type v.x, where x is the level of the categorical variable for which this binary variable is equal to 1.
Sengupta and Jammalamadaka (2019), Linear Models and Regression with R: An Integrated Approach.
# NOT RUN { x <- c(1,2,2,3,1,1,2,3,3,2,1) binaries(x) binaries(as.factor(x)) # }
Run the code above in your browser using DataLab