moving_average | R Documentation |
Calculate moving average of a sequence of values over a defined
window that extends d
units either side of the central value (hence
d=1
returns the original sequence). NA values are not counted in the
numerator or denominator of the average. Where the window goes beyond the
limits of the sequence, these values can included in the moving average
(simply ignoring values outside the range) or returned as NA.
moving_average(x, d = 3, include_ends = TRUE)
x |
vector of numeric values. |
d |
how far to look either side of central value. For example,
|
include_ends |
if |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.