Please read the last line to every message on r-help. In particular
make it reproducible and minimal. The code you post should look like
this where you have cut down DF1, DF2 and DF3 to the smallest number
of rows that still exhibits the error.
DF1 <- ...output from dput(DF1)....
DF2 <- ...output from dput(DF2)...
DF3 <- ...output from dput(DF3)...
z1 <- zoo(...)
z2 <- zoo(...)
z3 <- zoo(...)
m <- merge(z1, z2)
m2 <- merge(z3, m) # error
On Sun, Sep 27, 2009 at 8:42 AM, gunnar.p <pruss at uni-potsdam.de>
wrote:>
> 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.
>
> ______________________________________________
> R-help at 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.
>