[R] uneven vector length issue with read.zoo?

knavero knavero at gmail.com
Thu May 3 02:48:42 CEST 2012


So with case (6) here's the general structure of what I have:

chw = read.table("crac.csv", skip = 1, header = TRUE,
   colClasses = rep(c("NULL", NA, "numeric", "NULL"),
      c(3, 1, 1, 24)),
   sep = ",")
chw$Time.1 = as.POSIXct(chw$Time.1, format = fmt, tz = TZ)
chw = na.omit(chw)
chw = read.zoo(chw, header = TRUE,
   colClasses = rep(c(NA, "numeric"), c(1, 1)),
   FUN = chr, aggregate = tail1)

You don't have to try this, but the main point is that 

read.table -> POSIXct -> na.omit -> read.zoo and chron

I guess this alternative solution is adequate along with using readLines.
Initially I was hoping just a simple read.zoo would do the trick. The catch
is that I need the index/timestamp column to be in chron format for an easy
na.approx function to deal with things. Thank you for the readLines
suggestion Rui. Much appreciated.

--
View this message in context: http://r.789695.n4.nabble.com/uneven-vector-length-issue-with-read-zoo-tp4604287p4604841.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list