https://github.com/maxconway/r4ds_solutions/blob/master/transform_solutions.Rmd#5-look-at-each-destination-can-you-find-flights-that-are-suspiciously-fast-ie-flights-that-represent-a-potential-data-entry-error-compute-the-air-time-a-flight-relative-to-the-shortest-flight-to-that-destination-which-flights-were-most-delayed-in-the-air
For this question you provide a continued answer to the previous question. I thought I might provide a possible answer (noting you and I tend to answer these very differently!)
flights %>% group_by(dest)%>% mutate(fastest = quantile(air_time, 0.01, na.rm=T))%>% filter(air_time < fastest)
This should give you the 1% quantile for each origin+destination combo and then find flights which are below that quantile.
https://github.com/maxconway/r4ds_solutions/blob/master/transform_solutions.Rmd#5-look-at-each-destination-can-you-find-flights-that-are-suspiciously-fast-ie-flights-that-represent-a-potential-data-entry-error-compute-the-air-time-a-flight-relative-to-the-shortest-flight-to-that-destination-which-flights-were-most-delayed-in-the-air
For this question you provide a continued answer to the previous question. I thought I might provide a possible answer (noting you and I tend to answer these very differently!)
flights %>% group_by(dest)%>% mutate(fastest = quantile(air_time, 0.01, na.rm=T))%>% filter(air_time < fastest)This should give you the 1% quantile for each origin+destination combo and then find flights which are below that quantile.