Closed mearsdj closed 3 years ago
Can you please provide a minimal, reproducible example that demonstrates the behavior?
Thanks for the quick response. Sure: dts<-seq(as.Date("2017/01/01"),by=1,length.out=105) d<-zoo(c(NA,NA,NA,NA,NA,1:100),dts) d2<-WMA(d,n=10,wts=((1:10)/55)) str(d) str(d2)
This is a duplicate of #96 and was fixed in 9fe5cc53e3a63e085f7c67cfe0b5ad691440cbea.
It seems like there is an error, or unintended behavior, in WMA in the situation where NROW(wts)==n is true. That's because: if( NROW(wts) == n ) { 275
276 x <- na.omit(x)
You remove all na's from the data input and then calculate ma on x.
However, when you then call reclass(ma,x) after the ma is calculated, ma and x are of different length in the situation where x contained na. I think that means reclass will never succeed in that situation. Agree? If so, is there a reason for that, or is it just an situation that hasn't come up?