Skip to contents

Prep data for basic time series plot. Prep steps were taken from `LBoM::plot.LBoM` and they include handling missing values and zeroes, and optionally trimming time series.

Usage

iidda_prep_series(
  data,
  series_variable = "deaths",
  time_variable = "period_end_date",
  grouping_variable = "cause",
  time_unit = "year",
  summarize_series = TRUE,
  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)
)

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"

grouping_variable

column name of the grouping variable in `data` to summarize the series variable over, if `summarize=TRUE`

time_unit

time unit to sum series data over, must be one of iidda.analysis:::time_units, defaults to "year".

summarize_series

boolean value to indicate summarizing by `time_unit` over the series variable

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

Value

all fields in `data` with records prepped for plotting moving average time series