[R] zoo.read intraday data

Immanuel mane.desk at googlemail.com
Mon Oct 25 15:02:54 CEST 2010


Hello all,

I'm trying to use zoo.read but can't figure out
how to deal with the time format. (example below)

would be nice if someone could help.

best regards,
Immanuel

---------------------------
L <- "Date,Time,Open,High,Low,Close,Up,Down
        05.02.2001,00:30,421.20,421.20,421.20,421.20,11,0
        05.02.2001,01:30,421.20,421.40,421.20,421.40,7,0
        05.02.2001,02:00,421.30,421.30,421.30,421.30,0,5
        05.02.2001,02:30,421.60,421.60,421.50,421.50,26,1"

library(zoo)
library(chron)

f <- function(x) chron(paste(x[,1]),paste(x[,2]), format
                    = c(dates = "D.M.Y", times = "hh:mm"))

z <- read.zoo(textConnection(L), index = 1:2, sep=",", header = TRUE,
FUN  = f)

print(z)



More information about the R-help mailing list