Use explicit ifelse

Fixes #852
This commit is contained in:
Hadley Wickham 2021-04-18 09:29:27 -05:00
parent 42bbae55d3
commit 023606e9aa
1 changed files with 1 additions and 1 deletions

View File

@ -486,7 +486,7 @@ We can fix this by adding `days(1)` to the arrival time of each overnight flight
flights_dt <- flights_dt %>%
mutate(
overnight = arr_time < dep_time,
arr_time = arr_time + days(overnight * 1),
arr_time = arr_time + days(ifelse(overnight, 0, 1)),
sched_arr_time = sched_arr_time + days(overnight * 1)
)
```