group_by {ir}R Documentation

Group rows in ir objects by one or more variables

Description

Group rows in ir objects by one or more variables

Usage

group_by.ir(
  .data,
  ...,
  .add = FALSE,
  .drop = dplyr::group_by_drop_default(.data)
)

ungroup.ir(.data, ...)

Arguments

.data

An object of class ir.

...

In group_by(), variables or computations to group by. Computations are always done on the ungrouped data frame. To perform computations on the grouped data, you need to use a separate mutate() step before the group_by(). Computations are not allowed in nest_by(). In ungroup(), variables to remove from the grouping.

.add

When FALSE, the default, group_by() will override existing groups. To add to the existing groups, use .add = TRUE.

This argument was previously called add, but that prevented creating a new grouping variable called add, and conflicts with our naming conventions.

.drop

Drop groups formed by factor levels that don't appear in the data? The default is TRUE except when .data has been previously grouped with .drop = FALSE. See group_by_drop_default() for details.

Value

.data with grouped rows (group_by.ir()) or ungrouped rows (ungroup.ir()).

Source

dplyr::group_by()

See Also

Other tidyverse: arrange.ir(), distinct.ir(), extract.ir(), filter-joins, filter.ir(), mutate-joins, mutate, nest, pivot_longer.ir(), pivot_wider.ir(), rename, rowwise.ir(), select.ir(), separate.ir(), separate_rows.ir(), slice, summarize, unite.ir()

Examples

## group_by
dplyr::group_by(ir_sample_data, sample_type)


## ungroup
dplyr::ungroup(dplyr::group_by(ir_sample_data, sample_type))



[Package ir version 0.2.1 Index]