slice_max_helper: select row with maximum value of a variable for each grouping...

View source: R/slice_max_helper.R

slice_max_helperR Documentation

select row with maximum value of a variable for each grouping variable

Description

select row with maximum value of a variable for each grouping variable

Usage

slice_max_helper(df, group_var, max_var, n = 1)

Arguments

df

a data frame

group_var

a grouping variable

max_var

a numeric variable

n

number of elements to select from each group

Examples

library(dplyr)
mtcars %>% slice_max_helper(vs, mpg)


PatrickCoyle/cmisc documentation built on June 23, 2022, 3:07 p.m.