Skip to contents

Converts data from hub format to the format required by EpiNow2 package for estimating reproduction numbers and generating forecasts.

Usage

convert_hub_to_epinow2(
  hub_data,
  date_col = "date",
  cases_col = "value",
  location_col = "location",
  location_filter = NULL
)

Arguments

hub_data

Data frame in hub format with date and case columns

date_col

Character. Name of the date column. Default is "date".

cases_col

Character. Name of the cases column. Default is "value".

location_col

Character. Name of the location column. Default is "location".

location_filter

Character. Location to filter for (if multiple locations). Default is NULL.

Value

A data frame formatted for EpiNow2 with columns: date, confirm

Examples

if (FALSE) { # \dontrun{
hub_data <- data.frame(
  date = seq.Date(as.Date("2023-01-01"), by = "day", length.out = 50),
  location = "US",
  value = rpois(50, 100)
)
epinow2_data <- convert_hub_to_epinow2(hub_data, location_filter = "US")
} # }