specifies whether result should be centered (default), left-aligned or right-aligned.
endrule
character string indicating how the values at the
beginning and the end (of the data) should be treated.
"keep"
keeps the first and last $k2$ values
at both ends, where $k2$ is the half-bandwidth k2
= k %/% 2,
i.e., y[j] = x[j] for $j = 1,..,k2 and (n-k2+1),..,n$;
"constant"
fill the ends with first and last calculated value in output array
(out[1:k2] = out[k2+1])
"NA"
the default, leaves the values to NA, as they are returned by filter.
Value
Details
The implementation is using the function filter to calculate the moving average.
See Also
There's a faster implementation of running mean in the package caToolsrunmean() and a slower one in forecastma().