Skip to content

Commit

Permalink
Use explicit ifelse
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Apr 18, 2021
1 parent 42bbae5 commit 023606e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datetimes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
```
Expand Down

0 comments on commit 023606e

Please sign in to comment.