On Mon, Aug 16, 2010 at 8:00 PM, skan <juanp...@gmail.com> wrote: > > I've just seen that sep sep cannot be "," because there are not commas in > the file. > but I want it to take the first and second columns (date and time) as a > whole, the index. >
In the latest version of zoo index.column= can be a list. index.column = list(1:2), which can be abbreviated to just index.column = 1:2, would pass the first two columns to FUN as a single argument consisting of a two column matrix whereas index.column = list(1, 2) would pass them as separate arguments. Using the latter: Lines <- "date time value 1999-11-11 10:20:00 1.2222" library(zoo) library(chron) # z <- read.zoo("myfile.dat", index = list(1, 2), header = TRUE, z <- read.zoo(textConnection(Lines), index = list(1, 2), header = TRUE, FUN = function(date, time) as.chron(paste(date, time))) ______________________________________________ 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.