[R] Moving Average on Defined Intervals

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jul 30 13:31:05 CEST 2009


See ?cut and ?tapply for your first problem.  Those together with
?rollappy in the zoo package can likely handle your second problem.

In the future please read the last line to every message on r-help before
posting.

On Thu, Jul 30, 2009 at 6:15 AM, Hadassa
Brunschwig<hadassa.brunschwig at mail.huji.ac.il> wrote:
> Hi all
>
> I have been looking (in the help archives) for a function
> which does a moving average. Nothing new, I know.
> But I am looking for a function which is very flexible:
> The user should be able to input a vector of breaks
> which define the bins (and not just the number of observations in a bin).
> The function would then calculate which observations fall into this bin
> and calculate, say, an average.
> Another parameter should be the overlap (probably only when
> the breaks of the bins are equidistant).
>
> I am sure I am not the first one to think about this problem.
> Thanks for any hints.
> Hadassa
>
> --
> Hadassa Brunschwig
> PhD Student
> Department of Statistics
> The Hebrew University of Jerusalem
> http://www.stat.huji.ac.il
>
> ______________________________________________
> R-help at r-project.org 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