Description Usage Arguments Value Author(s) References Examples
Converts list columns into separate columns or into a long form.
1 2 3 | col_flatten(indt, cols, drop = FALSE)
col_flattenLong(indt, cols)
|
indt |
The input |
cols |
Character vector containing the names of list columns |
drop |
Logical. Should the list columns be dropped from the original
|
A data.table
.
Ananda Mahto
http://stackoverflow.com/q/34206003/1270695
1 2 3 4 5 6 7 8 9 10 11 | df <- structure(
list(CAT = structure(1:2, .Label = c("A", "B"), class = "factor"),
COUNT = list(1:3, 4:5), TREAT = list(c("Treat-a", "Treat-b"),
c("Treat-c", "Treat-d", "Treat-e"))),
.Names = c("CAT", "COUNT", "TREAT"),
row.names = c(NA, -2L), class = "data.frame")
col_flatten(df, c("COUNT", "TREAT"), TRUE)
col_flattenLong(df, c("COUNT", "TREAT"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.