Description Usage Arguments Value Author(s) References Examples
View source: R/list_unlister.R
Unlists columns of lists by row creating combinations of values in the process.
1 | list_unlister(indt, addRN = TRUE)
|
indt |
The input |
addRN |
Logical. Should a column named "rn" be added to the
|
A data.table
.
Ananda Mahto
http://stackoverflow.com/q/23217958/1270695
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | L1 <- list(list("A", c("B", "C")), list(1:2, 1:3))
list_unlister(L1)
## Note the NULLs and the shorter length of the first list item
L2 <- list(V1 = list("A", c("A", "B"), "X", NULL),
V2 = list(1, c(1, 2, 3), c(1, 2), c(1, 2, 3, 4), 1),
V3 = list(c("a", "b"), "c", "d", c("e", "f"), c("g", "h", "i")))
list_unlister(L2)
DT <- data.table::data.table(
x1 = list("A", c("A", "B"), "X", NULL, c("Z", "W")),
x2 = list(1, c(1, 2, 3), c(1, 2), c(1, 2, 3, 4), 1),
x3 = list(c("a", "b"), "c", "d", c("e", "f"), c("g", "h", "i")))
list_unlister(DT)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.