Description Usage Arguments Details Value
Calculates the running average (moving average) over a numeric vector
1 |
x |
numeric vector |
w |
size of window |
org_length |
if TRUE, returns a vector of the same length as |
if org_length = TRUE
, the function returns a vector of the same length as x
by appending NA
values at the start and the end of the vector of running averages. If w
is an odd number greater than 1, (w - 2) / 2
NA
values will be attached at the start and the end of the running average, so that each running average is matched with the mid-point of the interval over which it is calculated. If w
is an even number greater than 0, w/2
NA
values will be attached at the start and w/2 - 1
values at the end of vector of running averages, so that the running averages are matched with corresponding elements in x
with the smallest integer value larger than the midpoint of the window. For example, the 6th element of the returned vector will correspond to the average of the c(4,5,6,7)
elements of x
when a window size of 4 is requested.
returns the running average of vector x
with window w
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.