Skip to contents

Prep data for plotting bar graphs. Prep steps were taken from `LBoM::monthly_bar_graph` and `LBoM::weekly_bar_graph` and they include handling missing values and aggregating series data by time unit grouping variable.

Usage

iidda_prep_bar(
  data,
  series_variable = "deaths",
  time_variable = "period_end_date",
  time_unit = "week",
  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"

time_unit

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

handle_missing_values

function to handle missing values, defaults to HandleMissingValues

handle_zero_values

function to handle zero values, defaults to HandleZeroValues

Value

`data` with records prepped for plotting bar graphs with `series_variable` and `time_unit` field. The name of the resulting `time_unit` field will be named from lubridate_funcs.