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)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to