On Fri, Oct 15, 2010 at 3:22 PM, Megh Dal <megh700...@yahoo.com> wrote: > Hi Gabor, please see the attached files which is in text format. I have > opened them on excel then, used clipboard to load them into R. Still really > unclear what to do. > > Also can you please elaborate this term "index = list(1, 2), FUN = > function(d, t) as.POSIXct(paste(d, t))" in your previous file? In help, it is > given that:"If FUN is specified then read.zoo calls FUN with the index as the > first argument". I really could not connect your syntax with help.
1. It works for me with the files you supplied. Note that you have some duplicate times in your first file so I aggregated them using only the last of any set of duplicates: > library(zoo) > dat11 <- read.zoo("dal1.csv", aggregate = function(x) tail(x, 1), + sep = ",", header = TRUE, tz = "", format = "%m/%d/%Y %H:%M:%S") > dat22 <- read.zoo("dal2.csv", + sep = ",", header = TRUE, tz = "", format = "%m/%d/%Y %H:%M:%S") > m <- merge(dat11, dat22) > str(m) ‘zoo’ series from 2010-10-15 09:00:24 to 2010-10-15 13:49:51 Data: num [1:361, 1:8] 74.3 74.3 74.3 74.2 74.2 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr [1:8] "data.open.dat11" "data.high.dat11" "data.low.dat11" "data.close.dat11" ... Index: POSIXct[1:361], format: "2010-10-15 09:00:24" "2010-10-15 09:01:15" ... > > > packageDescription("zoo")$Version [1] "1.6-4" 2. You seem to be using an old version of zoo. With the latest version of zoo on CRAN, 1.6-4, the index.column= documentation in help(read.zoo) does document the list construction. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.