I've recently started dabbling with some time-series analysis in R, and I'm a little confused as to how the filter function in the stats library works. Essentially, I've seen it asserted that, for a daily time series, that filter could be used to decompose the series into yearly, seasonal and weekly components using something like the following:
x.year <- filter(x, rep(1/365, 365))
x.season <- filter(x, rep(1/90, 90))
x.weekly <- filter(x, rep(1/7, 7))
While I can figure out that the rep(1/period, period) gives you a component of length period, I'm not sure why, and am trying to avoid cargo cult analysis. Consulting the documentation, that bit is apparently, "a vector of filter coefficients in reverse time order" - just not sure what that means.
Anyone care to point me in the right direction?