Skip to contents

This function allows you to obtain COVID-19 forecasts based on selected data source. The data can come from covidHubUtils, cache or test depending on preference.

Usage

get_hub_forecasts(
  source = c("covidHubUtils", "cache", "test"),
  models = NULL,
  write_copy = TRUE
)

Arguments

source

A character vector to specify where the forecast data should be obtained from (default is 'covidHubUtils'). Accepted values include "covidHubUtils" for fetching data online, "cache" for reading saved data from local cache, and "test" for loading test data locally.

models

A character vector of models to be included in the query. Default is NULL which includes COVIDhub-trained_ensemble, COVIDhub-ensemble, and COVIDhub-baseline.

write_copy

A logical value indicating if a copy of the downloaded data should be written to the analysis directory. Default is TRUE.

Value

Returns a dataframe containing COVID-19 forecasts with columns for model name, forecast date, location, target end date, type, quantile, and value.

Examples

#get Hub forecasts using default arguments:
get_hub_forecasts()
#> Error in get_hub_forecasts(): object 'su_yaml' not found

#get Hub forecasts specifying model(s):
get_hub_forecasts(models = c("COVIDhub-ensemble"))
#> Error in get_hub_forecasts(models = c("COVIDhub-ensemble")): object 'su_yaml' not found

#read saved data from cache:
get_hub_forecasts(source = "cache")
#> Error in get_hub_forecasts(source = "cache"): object 'su_yaml' not found

#load test data:
get_hub_forecasts(source = "test")
#> Error in get_hub_forecasts(source = "test"): object 'su_yaml' not found