View source: R/slice_max_helper.R
slice_max_helper | R Documentation |
select row with maximum value of a variable for each grouping variable
slice_max_helper(df, group_var, max_var, n = 1)
df |
a data frame |
group_var |
a grouping variable |
max_var |
a numeric variable |
n |
number of elements to select from each group |
library(dplyr) mtcars %>% slice_max_helper(vs, mpg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.