Saji Ren wrote:
> 
> ...
>> MA2 = filter(x,c(rep(1/2,2),0),sides = 1)
>> MA2
>  [1]  NA  NA 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
> 
> But what I want is:
> [1]  NA  NA 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5
> 
> And I think the command I used to get MA2 should give a result as what I
> want, but it just does not.
> I want to know the reason, and I wondor if anyone could introduce a more
> convinient way to compute that.
> 

How about

MA2 <- filter(yts,c(0,rep(0.5,2)),sides=1)

Berend
-- 
View this message in context: 
http://n4.nabble.com/Help-with-Moving-Average-in-R-tp989627p989645.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to