I'd like to compute the average distance of the flights which have reached a destination by using the flights
data frame.
Here is my code :
library(nycflights13)
destinations <- group_by(flights, dest)
summarise(destinations, avg_distance = mean(distance))
Here is the result :
planes
1 1039.913
And I like to have something like that:
dest | avg_distance
IAH | 1405
ORD | 890
How could I do that with dplyr?