Learn R Programming

turner (version 0.1.9)

list_to_dummy: 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)

Value

A matrix of dummy variables

Arguments

alist

a list of vectors

Author

Gaston Sanchez

See Also

dummy_to_list, listify

Examples

Run this code
# 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)

Run the code above in your browser using DataLab