[R] rolling around rollapply in a zoo

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 4 02:18:35 CEST 2006


As indicated in ?rollmean there are only ts and zoo methods
for rollapply. Try

   rollapply(zoo(1:10), 3, mean)

Also note that as indicated in ?rollmean, rollmean does
have a default method:

   rollmean(1:10, 3)

On 10/3/06, Horace Tso <Horace.Tso at pgn.com> wrote:
> Hi list,
>
> I'm a little confused about rollapply in zoo. There is written that
> rollapply has replaced rapply in version 1.2-0 which is what i have. But
> when I tried,
>
> > rollapply(1:100, 10, mean)
>
> I got,
>
> Error in rollapply(1:100, 10, mean) : no applicable method for
> "rollapply"
>
> So I went back to the good old rapply
>
> > rapply(1:100, 10, mean)
> Error in rapply(1:100, 10, mean) : no applicable method for
> "rollapply"
> In addition: Warning message:
> 'rapply' is deprecated.
> Use 'rollapply' instead.
> See help("Deprecated")
>
> Is there a more updated version of zoo?
>
> Thanks.
>
> Horace W. Tso
>
> =======================================
> >sessionInfo()
> Version 2.3.1 (2006-06-01)
> i386-pc-mingw32
>
> attached base packages:
> [1] "splines"   "methods"   "datasets"  "stats"     "tcltk"     "utils"
>
> [7] "graphics"  "grDevices" "base"
>
> other attached packages:
>    lmtest      Hmisc    tseries   quadprog        zoo       MASS
> Rpad
>  "0.9-18"   "3.0-12"   "0.10-1"    "1.4-8"    "1.2-0" "7.2-27.1"
> "1.1.1"
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list