Last data update: 2014.03.03
|
R: Create a dummy matrix from the elements in a vector
vector_to_dummy | R Documentation |
Create a dummy matrix from the elements in a vector
Description
Create a dummy matrix based on the elements of a vector.
Each column in the produced matrix is a dummy indicator.
Usage
vector_to_dummy(avector)
Arguments
Value
A matrix of dummy variables
Author(s)
Gaston Sanchez
See Also
list_to_dummy ,
factor_to_dummy
Examples
# let's say you have a list like this
num_vec = c(2, 3, 1, 4)
# get dummy matrix
vector_to_dummy(num_vec)
Results
|