flights_sml <- select(flights, year:day, ends_with("delay"), distance, air_time)
flights_sml <- select(flights, year:day, ends_with("delay"), distance, air_time)
mutate(flights_sml, gain = dep_delay - arr_delay, speed = distance/air_time * 60)
A tibble: 336,776 × 9
year month day dep_delay arr_delay distance air_time gain speed
1 2013 1 1 2 11 1400 227 -9 370.
2 2013 1 1 4 20 1416 227 -16 374.
3 2013 1 1 2 33 1089 160 -31 408.
4 2013 1 1 -1 -18 1576 183 17 517.
5 2013 1 1 -6 -25 762 116 19 394.
6 2013 1 1 -4 12 719 150 -16 288.
7 2013 1 1 -5 19 1065 158 -24 404.
8 2013 1 1 -3 -14 229 53 11 259.
9 2013 1 1 -3 -8 944 140 5 405.
10 2013 1 1 -2 8 733 138 -10 319.
ℹ 336,766 more rows
ℹ Use print(n = ...) to see more rows
flights_sml <- select(flights, year:day, ends_with("delay"), distance, air_time)