I'm looking to find the min and max values of a column for each group:
mtcars %>%
group_by(mtcars$cyl) %>%
summarize(
min_mpg = min(mtcars$mpg),
max_mpg = max(mtcars$mpg)
)
# # A tibble: 3 x 3
# `mtcars$cyl` min_mpg max_mpg
# <dbl> <dbl> <dbl>
# 1 4 10.4 33.9
# 2 6 10.4 33.9
# 3 8 10.4 33.9
It works for the most part and the format of the dataset looks good. However, it gives the min and max of the entire dataset, not of each individual group.