[R] General "moving" functions

Neil Osborne r_stuff_online at hotmail.com
Thu May 2 11:26:59 CEST 2002


General "moving" function.

I'm a relatively new comer to R, and I've only just started writing my own R 
functions. However, I need some help for something which I'm sure is quite 
straight forward.

I want to write a function that will allow me to calculate "moving results" 
for a given vector. Ideally, the function will be of the form


foo<-function(vector1, funcname, lag)
{

}

for example, if I use arguments :

funcname = mean
lag = 10


Then foo will return a vector of 10 day moving average

Many Thanks

_________________________________________________________________


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list