Description Usage Arguments Details Value Functions Examples
This function returns a simple moving sum of the given vector. The weight argument is optional.
1 2 3 4 |
vec |
A numeric vector. |
n |
An integer: moving window size, with 1 as default |
ss |
An integer: step size, only calculating at points with an equal distance ss. Namely, there are ss-1 number between each two 'consecutive' points |
w |
An optional weight vector of length n. |
na_rm |
logical. Should missing values (including NaN) be removed? |
sizeD |
logical. Only applied when ss > 1, it decides whether to get a result of smaller size. If sizeD = T, align does not affect the output. |
align |
A string denotes how to align the moving average, three options: "left", "middle", "right" |
This function can obtain the moving sum efficiently. It serves as somehow a generalized
version of movMean
. The difference is that it will not automatically
normalized the weights vector, w argument.
If there is no missing value in vec, and w is normalized, which means
the sum of all elements is 1, this function will return a moving average.
This function returns a vector whose length is the same as that of vec or is
ceiling
((L - n + 1)/ss), (when sizeD = T), where L is the
length of vec.
movSumr
: An function equivalent to movMean(..., align = "right")
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.