>>>>> "Kjetil" == Kjetil Brinchmann Halvorsen <[EMAIL PROTECTED]>
>>>>>     on Fri, 24 Sep 2004 08:34:19 -0400 writes:

    Kjetil> Schwarz,Paul wrote:
    >> Dear R-Help readers,
    >> 
    >> I suspect that this question must be a FAQ, but my
    >> investigation of the archives has not been very
    >> revealing.  Is there an R function for calculating moving
    >> averages of time series objects?
    >> 
    >> 
    >> 
    Kjetil>  library(gregmisc) ?running test <- ts(rnorm(100))

    Kjetil>  test2 <- running(test, fun=median, width=10)
    Kjetil> length(test2) [1] 91

    Kjetil> you want fun=mean

Note that really for 
  - running mean, you should use  filter()
  - running median, you use       runmed()

Greg's running() function is probably appropriate for anything
else *but* these two cases...

Martin Maechler

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to