[R] What is filter() function doing?

2008-08-10 Thread Sergey Goriatchev
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@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.


Re: [R] What is filter() function doing?

2008-08-10 Thread Gabor Grothendieck
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 [EMAIL PROTECTED] 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@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.


__
R-help@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.