| nest | R Documentation |
nest() collapses the rows of each group into a data frame and stores those
data frames in a single list-column, giving one row per group. Groups appear
in order of first occurrence. Missing values in by form their own group.
nest(data, by, name = "data")
data |
A data frame. |
by |
Character vector of grouping columns. |
name |
Name of the new list-column. |
A basetable with the by columns and one list-column holding the
remaining columns of each group as a data frame.
unnest(), split()
nested <- nest(data.frame(g = c("a", "a", "b"), x = 1:3), by = "g")
nested
nested$data[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.