nest_by: Nest By

Description Usage Arguments Details Examples

View source: R/nest_by.R

Description

nest_by() is similar to group_by() however instead of storing the group structure in the metadata, it is made explicit in the data. Each group key is given a single row within the data.frame and the group's data is stored within a list-column of the data.frame.

Usage

1
nest_by(.data, ..., .key = "data", .keep = FALSE)

Arguments

.data

A data.frame.

...

Grouping specification, forwarded to group_by().

.key

character(1). The name of the column in which to nest the data (default: "data").

.keep

logical(1). Should the grouping columns be kept (default: TRUE)?

Details

Currently there is no pretty-printing provided for the results of nest_by() and they are not useable with other functions such as mutate().

Examples

1
2
3
mtcars %>% nest_by(am, cyl)
# Or equivalently
mtcars %>% group_by(am, cyl) %>% nest_by()

poorman documentation built on March 28, 2021, 5:05 p.m.