[R] Wrong output due to what I think might be a data type issue (zoo read in problem)

knavero knavero at gmail.com
Tue Mar 20 06:24:55 CET 2012


found a temporary fix (I'm sure it's redundant and not as elegant, but here
it is):

require(zoo)
require(chron)
setwd("/home/knavero/Desktop/")

fmt = "%m/%d/%Y %H:%M"
tail1 = function(x) tail(x, 1)
rawData = read.zoo("weatherData.txt", header = T, FUN = as.chron,
   format = fmt, sep = "\t", aggregate = tail1)
   #colClasses = c(NA, "matrix"))

rawData = zoo(cbind(temp = as.vector(rawData)), time(rawData))

oneMin = seq(start(rawData), end(rawData), by = times("01:00:00"))
intData = na.approx(rawData, xout = oneMin)

par(mfrow = c(3, 1), oma = c(0, 0, 2, 0), mar = c(2, 4, 1, 1))

plot(rawData, type = "p", ylim = c(0, 100))
grid(col = "darkgrey")

plot(intData, type = "p", ylim = c(0, 100))
grid(col = "darkgrey")

Silly coding huh? It works though....the plots were just to double check
btw...nothing significant obviously


--
View this message in context: http://r.789695.n4.nabble.com/Wrong-output-due-to-what-I-think-might-be-a-data-type-issue-zoo-read-in-problem-tp4487682p4487739.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list