1 Matching Annotations
  1. Jan 2021
    1. flights %>% # sort in increasing order select(tailnum, year, month,day, dep_delay) %>% filter(!is.na(dep_delay)) %>% arrange(tailnum, year, month, day) %>% group_by(tailnum) %>% # cumulative number of flights delayed over one hour mutate(cumulative_hr_delays = cumsum(dep_delay > 60)) %>% # count the number of flights == 0 summarise(total_flights = sum(cumulative_hr_delays < 1)) %>% arrange(total_flights)

      Here you counted the opposite, meaning the flights AFTER the first delay of greater than 60 minutes the code should've looked something like this:

      flights %>% select(tailnum, year, month,day, dep_delay) %>% filter(!is.na(dep_delay)) %>% arrange(tailnum, year, month, day) %>% group_by(tailnum) %>% filter(dep_delay<=60 ) %>% summarise(total_flights = n()) %>% arrange(desc(total_flights))