Convert module output object into tibble

make_tibble_from_output(
  output,
  output_name = "value",
  index_col = "idx",
  ref_date = NULL,
  time_step = "day"
)

Arguments

output

Module input object. List with two elements:

  1. A numeric vector named values: the incidence recorded on consecutive time steps.

  2. An integer named index_offset: the offset, counted in number of time steps, by which the first value in values is shifted compared to a reference time step This parameter allows one to keep track of the date of the first value in values without needing to carry a date column around. A positive offset means values are delayed in the future compared to the reference values. A negative offset means the opposite.

output_name

string. Name to be given to the values column

index_col

string. Name of the index column included in the output. If a ref_date is passed to the function, the result will contain a date column instead. Even so, a value must be given to this argument for internal steps.

ref_date

Date. Optional. Date of the first data entry in incidence_data

time_step

string. Time between two consecutive incidence datapoints. "day", "2 days", "week", "year"... (see seq.Date for details)

Value

tibble

Examples

## Basic usage of make_tibble_from_output smoothed_incidence <- smooth_incidence( incidence_data = HK_incidence_data$case_incidence, smoothing_method = "LOESS" ) smoothed_incidence_tibble_1 <- make_tibble_from_output(smoothed_incidence) ## Advanced usage of make_tibble_from_output smoothed_incidence_tibble_2 <- make_tibble_from_output( output = smoothed_incidence, output_name = "incidence", ref_date = HK_incidence_data$date[1] )