group_by {crplyr}R Documentation

Group-by for Crunch datasets

Description

group_by() sets grouping variables that affect what summarize() computes. ungroup() removes any grouping variables.

Usage

## S3 method for class 'CrunchDataset'
group_by(.data, ..., .add = FALSE)

## S3 method for class 'CrunchDataset'
ungroup(x, ...)

Arguments

.data

For group_by(), a Crunch Dataset

...

references to variables to group by, passed to dplyr::group_by_prepare()

.add

Logical: add the variables in ... to any existing grouping variables, or replace them (the default).

x

For ungroup(), a Crunch Dataset

Details

Note that group_by() only supports grouping on variables that exist in the dataset, not ones that are derived on the fly. dplyr::group_by() supports that by calling mutate() internally, but mutate is not yet supported in crplyr.

Value

group_by() returns a GroupedCrunchDataset object (a CrunchDataset with grouping annotations). ungroup() returns a CrunchDataset.

Examples

## Not run: 
ds %>%
   group_by(cyl) %>%
   select(cyl, gear) %>%
   collect()

## End(Not run)

[Package crplyr version 0.3.9 Index]