Zoo - bug ???
I am not sure whether this is 100 % related, but I also get some unexpected behaviour with NA and rollapply: In the following example I would expect in Line 3 to see a 1 instead of an NA (mean out of [1, NA, NA] What do you think ?
mean(c(1,NA, NA), na.rm=TRUE)
[1] 1
A1a<-zoo(c(NA, NA, 1,2,3,4,5,6, NA, NA)) A1b<-rollapply(A1a,4,mean, na.rm=TRUE, na.pad=FALSE, align="right") View(cbind(A1a,A1b)) cbind(A1a,A1b)
A1a A1b 1 NA NA 2 NA NA 3 1 NA 4 2 1.5 5 3 2.0 6 4 2.5 7 5 3.5 8 6 4.5 9 NA 5.0 10 NA 5.5 ----- Christian Langkamp christian.langkamp-at-gmxpro.de
View this message in context: http://r.789695.n4.nabble.com/Zoo-bug-tp2287282p3065458.html Sent from the R help mailing list archive at Nabble.com.