1

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
nopeva
  • 1,583
  • 5
  • 22
  • 38

1 Answers1

2

This is what summer/winter time does to regular 4-hour intervals. Try working with a time zone that does not have summer time, like

Sys.setenv(TZ="UTC")
Edzer Pebesma
  • 3,814
  • 16
  • 26