select_groups: Select groups in dplyr

View source: R/formatting.R

select_groupsR Documentation

Select groups in dplyr

Description

This returns the selected groups in a dataframe by index number.

Usage

select_groups(data, groups, ...)

Arguments

data

Dataframe that has already been grouped using dplyr::group_by()

groups

Numeric vector of group numbers to use as the indices of the groups to select

Value

Same format as input dataframe, with only the selected groups, in the order listed. Duplicate group IDs are removed.

Examples

# This grabs the first 2 groups listed.
mtcars %>%
group_by(cyl) %>%
select_groups(1:2)


BIO-RSG/oceancolouR documentation built on April 30, 2024, 7:54 a.m.