Please help....I'm trying to calculate a 5-point rolling average and I keep
getting a length issue.
My script is
ma5<-function (x){
y<-numeric(length(x-2)
for(i in 2(length(x)-1)){
y[i]]<-(x[i-3]+x[i-2]+x[i-1]+x[i]+x[i+1]))/5
}
Y}
I keep getting a replacement has length zero
Ive tried changing the (x-2) to -3 and -4 and still get the same issue. Im
thinking that it should be -2 and that this issue is in the third line any
ideas?
Sandy Zelka, CPA, CAE, MBA, LB
Accounting Professor
(518) 469-8040
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac