powered by
Create a dummy matrix based on the elements of a vector. Each column in the produced matrix is a dummy indicator.
vector_to_dummy(avector)
A matrix of dummy variables
a numeric vector
Gaston Sanchez
list_to_dummy, factor_to_dummy
list_to_dummy
factor_to_dummy
# let's say you have a list like this num_vec = c(2, 3, 1, 4) # get dummy matrix vector_to_dummy(num_vec)
Run the code above in your browser using DataLab