- Mutate the data frame so that it includes a new variable that contains the average speed,
avg_speed traveled by the plane for each flight (in mph). What is the tail number of the plane with the fastest avg_speed? Hint: Average speed can be calculated as distance divided by number of hours of travel, and note that air_time is given in minutes. If you just want to show the avg_speed and tailnum and none of the other variables, use the select function at the end of your pipe to select just these two variables with select(avg_speed, tailnum). You can Google this tail number to find out more about the aircraft. Answer Question 8 to the left.
data("nycflights")
nycflights <- mutate(nycflights , avg_speed = distance / air_time)
nycflights %>%
group_by(tailnum) %>%
summarise( avg_speed = mean(avg_speed) ) %>%
arrange(desc(avg_speed))
## # A tibble: 3,490 × 2
## tailnum avg_speed
## <chr> <dbl>
## 1 N526AS 8.487633
## 2 N637DL 8.433246
## 3 N66051 8.411864
## 4 N907JB 8.410526
## 5 N522VA 8.382353
## 6 N5BTAA 8.322917
## 7 N654UA 8.309701
## 8 N382HA 8.247184
## 9 N75861 8.246154
## 10 N5DRAA 8.218600
## # ... with 3,480 more rows