Changed gain to be dep_delay - arr_delay, and not vice versa. (#595)

Fixes #594
This commit is contained in:
Albert Y. Kim 2018-06-20 01:00:48 -07:00 committed by Hadley Wickham
parent a2f7418c10
commit acb815d95f
1 changed files with 3 additions and 3 deletions

View File

@ -325,7 +325,7 @@ flights_sml <- select(flights,
air_time air_time
) )
mutate(flights_sml, mutate(flights_sml,
gain = arr_delay - dep_delay, gain = dep_delay - arr_delay,
speed = distance / air_time * 60 speed = distance / air_time * 60
) )
``` ```
@ -334,7 +334,7 @@ Note that you can refer to columns that you've just created:
```{r} ```{r}
mutate(flights_sml, mutate(flights_sml,
gain = arr_delay - dep_delay, gain = dep_delay - arr_delay,
hours = air_time / 60, hours = air_time / 60,
gain_per_hour = gain / hours gain_per_hour = gain / hours
) )
@ -344,7 +344,7 @@ If you only want to keep the new variables, use `transmute()`:
```{r} ```{r}
transmute(flights, transmute(flights,
gain = arr_delay - dep_delay, gain = dep_delay - arr_delay,
hours = air_time / 60, hours = air_time / 60,
gain_per_hour = gain / hours gain_per_hour = gain / hours
) )