Description Usage Arguments Value Examples
View source: R/rolling_window.R
Used for calculating a centered rolling window average at the weekly level, adjusted by the number of days in those weeks
1 | rollapply_epi(x, n_days, width = 3, na.rm = FALSE)
|
x |
numeric vector of tests per epiweek (or tests/device) |
n_days |
numeric vector, number of days per epi week |
width |
width (weeks) of rolling window |
na.rm |
logical of weather to discard NAs. |
Moving average in units/week
1 2 3 4 5 | x <- c(4, 14, 14, 14, 10, 10, 10, 10, 5)
n_days <- c(2, rep(7, times = (length(x) -2)), 3)
n_days
y <- rollapply_epi(x, n_days = n_days)
y
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.