rollapply_epi: Rolling window average across epiweeks.

Description Usage Arguments Value Examples

View source: R/rolling_window.R

Description

Used for calculating a centered rolling window average at the weekly level, adjusted by the number of days in those weeks

Usage

1
rollapply_epi(x, n_days, width = 3, na.rm = FALSE)

Arguments

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.

Value

Moving average in units/week

Examples

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

MartinHoldrege/turnr documentation built on May 16, 2020, 10:39 a.m.