View source: R/list_to_dummy.r
list_to_dummy | R Documentation |
Create a dummy matrix based on the elements of a list. Each column in the produced matrix is a dummy indicator.
list_to_dummy(alist)
alist |
a list of vectors |
A matrix of dummy variables
Gaston Sanchez
dummy_to_list
, listify
# let's say you have a list like this
num_list = list(1:3, 4:5, 6:9)
# get dummy matrix
list_to_dummy(num_list)
# try with a list of strings
str_list = list(c("a","b","c"), c("d", "e"), c("f","g","h"))
list_to_dummy(str_list)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.