Re: [R-SIG-Mac] Rolling average length issue

2010-11-06 Thread Gerald Jurasinski
Hi Sandy, Why don't you usw runmean() of the caTools package?? In the see also section of the help for runmean() there are various other possibilities given. Good Luck Gerald —— 3rd Law of Computing: Anything that can go wr fortune: Segmentation violation -- Core dumped Am 06.11.2010

Re: [R-SIG-Mac] Rolling average length issue

2010-11-06 Thread David Winsemius
On Nov 6, 2010, at 3:00 PM, Gerald Jurasinski wrote: Hi Sandy, Why don't you usw runmean() of the caTools package?? In the see also section of the help for runmean() there are various other possibilities given. Also rollmean or rollapply in package zoo. Eg: library(zoo)

[R-SIG-Mac] Rolling average length issue

2010-11-05 Thread Sandy Zelka
Please helpI'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 I’ve tried

Re: [R-SIG-Mac] Rolling average length issue

2010-11-05 Thread David Winsemius
On Nov 5, 2010, at 12:03 PM, Sandy Zelka wrote: Please helpI'm trying to calculate a 5-point rolling average and I keep getting a length issue. My script is Not a SIG-Mac issue. ma5-function (x){ y-numeric(length(x-2) for(i in 2(length(x)-1)){ You seem to missing an operator