list_to_dummy {turner} | R Documentation |
Create a dummy matrix from the elements in a list
Description
Create a dummy matrix based on the elements of a list. Each column in the produced matrix is a dummy indicator.
Usage
list_to_dummy(alist)
Arguments
alist |
a list of vectors |
Value
A matrix of dummy variables
Author(s)
Gaston Sanchez
See Also
Examples
# 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)
[Package turner version 0.1.9 Index]