I have a frame (M601_M_multi.godz) that basically has data on a daily basis. However, there are a few hours missing as you can see below. As a test, I calculate the difference between subsequent dates.
I am preparing a frame that contains all the hours:
raport.godz.lista <- data.frame(Czas = seq(as.POSIXct("2020-12-23 12:00:00"),
max(M601_M_multi.min$Czas),
by = "1 hour"))
I combine frames to get all times in my frame M601_M_multi.godz
M601_M_multi.godz.2 <- right_join(M601_M_multi.godz, raport.godz.lista, by = "Czas") %>%
arrange(Czas) %>%
mutate (
czas.delta = c(0, diff (Czas))) %>%
relocate(Minuty, .after = Czas) %>%
relocate(czas.delta, .after = Czas)
The effect is surprising:
- time difference is expressed in hours (previously it was in minutes)
- missing hours between January 10 and January 11
I have used this solution (connecting tables with dates) many times and I have never encountered such a problem. I will appreciate any tip