Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.71 exercises question 5 #2

Open
rtjohn opened this issue Sep 28, 2016 · 0 comments
Open

4.71 exercises question 5 #2

rtjohn opened this issue Sep 28, 2016 · 0 comments

Comments

@rtjohn
Copy link

rtjohn commented Sep 28, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant