fgroup_by: 'collapse' version of 'dplyr::group_by()'

View source: R/fgroup_by.R

fgroup_byR Documentation

'collapse' version of dplyr::group_by()

Description

This works the exact same as dplyr::group_by() and typically performs around the same speed but uses slightly less memory.

Usage

fgroup_by(
  data,
  ...,
  .add = FALSE,
  order = df_group_by_order_default(data),
  .by = NULL,
  .cols = NULL,
  .drop = df_group_by_drop_default(data)
)

Arguments

data

data frame.

...

Variables to group by.

.add

Should groups be added to existing groups? Default is FALSE.

order

Should groups be ordered? If FALSE groups will be ordered based on first-appearance.
Typically, setting order to FALSE is faster.

.by

(Optional). A selection of columns to group by for this operation. Columns are specified using tidyselect.

.cols

(Optional) alternative to ... that accepts a named character vector or numeric vector. If speed is an expensive resource, it is recommended to use this.

.drop

Should unused factor levels be dropped? Default is TRUE.

Details

fgroup_by() works almost exactly like the 'dplyr' equivalent. An attribute "sorted" (TRUE or FALSE) is added to the group data to signify if the groups are sorted or not.

Value

A grouped_df.


timeplyr documentation built on June 22, 2024, 10:01 a.m.