nest_by {poorman}R Documentation

Nest By

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

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

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


[Package poorman version 0.2.7 Index]