Calculates a function (.f
) of the top best_n
values
from x
over the previous window
days. Assumes that x
and index
are already in order according to index
.
1 2 | lag_best_n(x, index, best_n = 5, window = 365, .f = mean, adj = c(1.4,
1.3, 1.2, 1.1))
|
x |
numeric vector of values |
index |
dates, assumed to be character in YYYY-MM-DD format |
best_n |
integer |
window |
integer; previous number of days to examine |
adj |
vector of adjustments for when there are fewer than |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.