[R] zoo: merging aggregated zoo-objects fails

gunnar.p pruss at uni-potsdam.de
Sun Sep 27 14:42:05 CEST 2009


Dear all,
I have several text files looking like this:
  9063032 19700201 22:00 174.067
  9063032 19700201 23:00 174.076
  9063032 19700202 00:00 174.085
  9063032 19700202 01:00 174.091
  9063032 19700202 02:00 174.094
  9063032 19700202 03:00 174.091
  9063032 19700202 04:00 174.082
  9063032 19700202 05:00 174.079

And I run this loop: 
for (j in 1:nr.of.files)
{
   #Import:
   DF <- read.table(path,header=FALSE,na.string='-9999',
                    colClasses=c("NULL","character","character","numeric"))
   z  <- zoo(DF$V4,chron(dates=DF$V2,times=paste(DF$V3,0,sep=":"),
                         format=c(dates="ymd",times="h:m:s")))   
   #getting daily values:
   x  <- aggregate(z,trunc,mean)   
   #summing everything up in one nr.of.files-dimensional zoo-object
   if (j > 1) final <- merge(final,x) else final <- x
}

Unfortunately I get the following error message:
  "Fehler in matrix(unlist(lapply(dots, origin)), nrow = 3) : 
   Versuch ein Attribut von NULL zu setzen"
   (Error ... Trying to set an attribute NULL)

There is no error when I first run merge() and then aggregate(), but this is
not possible due to the rest of the program.
Does any one have a clue?

regards, gunnar
(R vers.2.9.1 (Debian Lenny, XFCE 4.4, EMACS 22.2.1, ESS 5.3.8))

-- 
View this message in context: http://www.nabble.com/zoo%3A-merging-aggregated-zoo-objects-fails-tp25633345p25633345.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list