me on twitter

brain of mat kelcey


moving average of a time series in R

June 15, 2010 at 04:15 PM | categories: simple stuff i keep forgetting, r | View Comments

in this a sliding window of 3 elements123456789> x = c(3,1,4,1,5,9,2,6,5,3,5,8)> ra_x = filter(x, rep(1,3)/3)> ra_xTime Series:Start = 1 End = 12 Frequency = 1 [1] NA 2.666667 2.000000 3.333333 5.000000 5.333333 5.666667 4.333333 [9] 4.666667 4.333333 5.333333 NA...
Read and Post Comments

old projects...