[R] Hourly data with zoo
moshersteven at gmail.com
Mon Sep 12 07:58:02 CEST 2011
I have date data as a numeric and hourly data in 0 to 2300 hours in a dataframe.
d <- rep(20110101,24)
h <- seq(from = 0, to = 2300, by = 100)
df <- data.frame(LST_DATE = d, LST_TIME = h, data = rnorm(24, 0, 1))
S <- chron(dates. = as.character(df$LST_DATE), times. =
paste(as.character(df$LST_TIME/100), ":0:0", sep = ""),
format = c(dates = "Ymd", times = "h:m:s"))
X <- zoo(df$data, order.by = S)
And I want to create a regular zoo series, The above works but its
pretty ugly. Is there a more elegant way to do this.
More information about the R-help