Nest data.tables
Nest data.tables by group
nest_by.(.df, ..., .key = "data", .keep = FALSE)
.df |
A data.frame or data.table |
... |
Columns to group by. If empty nests the entire data.table.
|
.key |
Name of the new column created by nesting. |
.keep |
Should the grouping columns be kept in the list column. |
test_df <- data.table( a = 1:5, b = 6:10, c = c(rep("a", 3), rep("b", 2)), d = c(rep("a", 3), rep("b", 2)) ) test_df %>% nest_by.() test_df %>% nest_by.(c, d) test_df %>% nest_by.(where(is.character)) test_df %>% nest_by.(c, d, .keep = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.