Skip to contents

Add a time series line to an exiting ggplot plot object.

Usage

iidda_plot_series(
  plot_object,
  data = NULL,
  series_variable = "deaths",
  time_variable = "period_end_date",
  time_unit = "year"
)

Arguments

plot_object

a `ggplot2` plot object

data

data frame containing time series data, typically output from `iidda_prep_series()`. If `NULL` data is inherited from `plot_object`

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 display on the x-axis.

Value

a ggplot2 plot object containing a moving average time series