ma | R Documentation |
Smoothing a time series with moving averages using the filter
function.
ma(x, n, sides = "past")
x |
numeric vector to be smoothed |
n |
numeric vector of length one determining the width of the smoothing window |
sides |
one of |
a vector as long as x, but smoothed. Possibly with NAs.
filter
ma(1:10, n = 3, sides = 2) # centred around lag 0 ma(1:10, n = 3) # past values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.