Prep Data for Moving Average Plot
iidda_prep_ma.Rd
Prep data for plotting moving average. Prep steps were taken from `LBoM::plot.LBoM` and they include handling missing values and zeroes, optionally trimming time series and computing the moving average.
Usage
iidda_prep_ma(
data,
series_variable = "deaths",
time_variable = "period_end_date",
trim_zeroes = TRUE,
trim_series = TrimSeries(zero_lead = FALSE, zero_trail = FALSE),
handle_missing_values = HandleMissingValues(na_remove = FALSE, na_replace = NULL),
handle_zero_values = HandleZeroValues(zero_remove = FALSE, zero_replace = NULL),
compute_moving_average = ComputeMovingAverage(ma_window_length = 52)
)
Arguments
- data
data frame containing time series data
- series_variable
column name of series variable in `data`, default is "deaths"
- time_variable
column name of time variable in `data`, default is "period_end_date"
- trim_zeroes
boolean value to filter data to exclude leading and trailing zeroes
- trim_series
function to trim leading and trailing series zeroes, defaults to TrimSeries
- handle_missing_values
function to handle missing values, defaults to HandleMissingValues
- handle_zero_values
function to handle zero values, defaults to HandleZeroValues
- compute_moving_average
function to compute the moving average of `series_variable`