The issue is similar to this issue from nycflights13 except now it looks like flights is on UTC and weather is on local time (for the machine in use) . I think the solution is to use lubridate::force_tz() on the time_hour variable pulling corresponding to timezone from airports::tzone for both?
library(nycflights23)
flights$time_hour[1:5]
#> [1] "2023-01-01 20:00:00 UTC" "2023-01-01 23:00:00 UTC"
#> [3] "2023-01-01 23:00:00 UTC" "2023-01-01 21:00:00 UTC"
#> [5] "2023-01-01 20:00:00 UTC"
weather$time_hour[1:5]
#> [1] "2023-01-01 01:00:00 MST" "2023-01-01 02:00:00 MST"
#> [3] "2023-01-01 03:00:00 MST" "2023-01-01 04:00:00 MST"
#> [5] "2023-01-01 05:00:00 MST"
Created on 2025-04-20 with reprex v2.1.1
The issue is similar to this issue from
nycflights13except now it looks likeflightsis on UTC andweatheris on local time (for the machine in use) . I think the solution is to uselubridate::force_tz()on thetime_hourvariable pulling corresponding to timezone fromairports::tzonefor both?Created on 2025-04-20 with reprex v2.1.1