I'm trying to go from 5 minute intervals to 4 hours intervals. The POSIXct
or zoo
/ xts
objects work fine. However, I have not been able to create the 4 hours intervals for the same hours of the day every day since summer time or winter, although correct, change my indexation.
This is what I've tried:
Sys.setenv(TZ="Europe/Paris") # to reproduce example
ts1 <- seq(as.POSIXct("2014-10-25 00:00:00"), as.POSIXct("2014-10-26 23:00:00"), by='5 min')
library(zoo)
x <- zoo(rnorm(length(ts1)), ts1)
# to construct an irregular time series
interval <- "4 hour"
ini <- min(index(x))
fin <- max(index(x))
tseq <- seq(ini, fin, by = interval); tseq