[R] What is filter() function doing?

Gabor Grothendieck ggrothendieck at gmail.com
Sun Aug 10 17:47:49 CEST 2008


For each time point is sums the value prior to it, the
value at the time point itself and the value at the next
time point.   For the first timepoint there is no prior
value so its NA.   For the second timepoint we have
1+2+3=6.  For the third timepoint we have 2+3+4=9 and
so on.

> filter(1:10, c(1, 1, 1))
Time Series:
Start = 1
End = 10
Frequency = 1
 [1] NA  6  9 12 15 18 21 24 27 NA


On Sun, Aug 10, 2008 at 11:32 AM, Sergey Goriatchev <sergeyg at gmail.com> wrote:
> Hello,
>
> I cannot understand what filter() function in package stat is doing.
> For example, what does filter(1:100, c(1,1,1)) mean?
> Could someone please explain? Help file is not enough for me.
>
> Thanks in advance.
> Sergey
>
> ______________________________________________
> 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