Description Usage Arguments Value Examples
Generates an n-item trailing average vector from a numerical vector, after first removing any missing values.
1 | rollingavg(myvec, n = 7)
|
myvec |
Numerical vector from which you want to calculate a trailing average |
n |
Number of items to be used for each mean calculation, such as 7 for a 7-day trailing average |
The n-item trailing average of myvec
1 2 | myvector <- c(100, 98, 97.5, 102, 96, 96.5, 97, 94, 92.3, 93, 95, 91, 89, 88, 88.5, 86)
my7dayavg <- rollingavg(myvector)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.