flights %>%
group_by(month) %>%
summarize(count = n(),
avg_dep_delay = mean(dep_delay, na.rm = TRUE),
max_dep_delay = max(dep_delay, na.rm = TRUE),
min_dep_delay = min(dep_delay, na.rm = TRUE),
)
# A tibble: 12 × 5
month count avg_dep_delay max_dep_delay min_dep_delay
<int> <int> <dbl> <dbl> <dbl>
1 1 27004 10.0 1301 -30
2 2 24951 10.8 853 -33
3 3 28834 13.2 911 -25
4 4 28330 13.9 960 -21
5 5 28796 13.0 878 -24
6 6 28243 20.8 1137 -21
7 7 29425 21.7 1005 -22
8 8 29327 12.6 520 -26
9 9 27574 6.72 1014 -24
10 10 28889 6.24 702 -25
11 11 27268 5.44 798 -32
12 12 28135 16.6 896 -43