Summarizing logical vectors (2)

flights |> 
  summarize(
    all_delayed = all(dep_delay <= 60, na.rm = TRUE),
    any_long_delay = any(arr_delay >= 300, na.rm = TRUE),
    .by = c(year, month, day)
  )
## # A tibble: 365 × 5
##     year month   day all_delayed any_long_delay
##    <int> <int> <int> <lgl>       <lgl>         
##  1  2013     1     1 FALSE       TRUE          
##  2  2013     1     2 FALSE       TRUE          
##  3  2013     1     3 FALSE       FALSE         
##  4  2013     1     4 FALSE       FALSE         
##  5  2013     1     5 FALSE       TRUE          
##  6  2013     1     6 FALSE       FALSE         
##  7  2013     1     7 FALSE       TRUE          
##  8  2013     1     8 FALSE       FALSE         
##  9  2013     1     9 FALSE       TRUE          
## 10  2013     1    10 FALSE       TRUE          
## # ℹ 355 more rows