R/load_latest_forecasts.R
load_latest_forecasts.Rd
#'
Please use load_forecasts()
instead.
load_latest_forecasts(
models = NULL,
last_forecast_date,
forecast_date_window_size = 0,
locations = NULL,
types = NULL,
targets = NULL,
source = "local_hub_repo",
hub_repo_path,
data_processed_subpath = "data-processed/",
as_of = NULL,
hub = c("US", "ECDC"),
verbose = TRUE
)
Character vector of model abbreviations. If missing, forecasts for all models that submitted forecasts meeting the other criteria are returned.
The forecast date of forecasts to retrieve in 'yyyy-mm-dd' format.
The number of days across which to look for recent forecasts. Default to 0, which means to only look at the last_forecast_date only.
list of fips. Defaults to all locations with available forecasts.
Character vector specifying type of forecasts to load: "quantile" or "point". Defaults to all types with available forecasts
character vector of targets to retrieve, for example c('1 wk ahead cum death', '2 wk ahead cum death'). Defaults to all targets.
string specifying where forecasts will be loaded from: either "local_hub_repo" or "zoltar"
path to local clone of the reichlab/covid19-forecast-hub repository
folder within the hub_repo_path that contains forecast submission files. Defaults to "data-processed/", which is appropriate for the covid19-forecast-hub repository.
character for date time to load forecasts submitted as of this time from Zoltar.
Ignored if source
is "local_hub_repo"
.
It could use the format of one of the three examples:
"2021-01-01", "2020-01-01 01:01:01" and "2020-01-01 01:01:01 UTC".
If you would like to set a timezone, it has to be UTC now.
If not, helper function will append the default timezone to your input based on hub parameter.
Default to NULL to load the latest version.
character vector, where the first element indicates the hub from which to load forecasts. Possible options are "US" and "ECDC"
a boolean for printing messages on zoltar job status. Default to TRUE.
data frame with columns model, forecast_date, location, horizon, temporal_resolution, target_variable, target_end_date, type, quantile, value, location_name, population, geo_type, geo_value, abbreviation
forecasts <- load_latest_forecasts(
models = "COVIDhub-ensemble",
last_forecast_date = "2020-12-07",
forecast_date_window_size = 6,
locations = "US",
types = c("point", "quantile"),
targets = paste(1:4, "wk ahead inc case"),
source = "zoltar",
verbose = FALSE,
as_of = NULL,
hub = c("US")
)
#> Warning: `load_latest_forecasts()` was deprecated in covidHubUtils 0.1.5.
#> ℹ This function has been superseded by the latest load_forecasts(). Please
#> switch your code to using the new function.
#> Warning: `load_latest_forecasts_zoltar()` was deprecated in covidHubUtils 0.1.5.
#> ℹ This function has been superseded by the latest load_forecasts_zoltar().
#> Please switch your code to using the new function.
#> ℹ The deprecated feature was likely used in the covidHubUtils package.
#> Please report the issue to the authors.
#> get_token(): POST: https://zoltardata.com/api-token-auth/
#> get_resource(): GET: https://zoltardata.com/api/projects/
#> get_resource(): GET: https://zoltardata.com/api/project/44/models/
#> get_resource(): GET: https://zoltardata.com/api/project/44/timezeros/
forecasts_ECDC <- load_latest_forecasts(
models = c("ILM-EKF"),
hub = c("ECDC", "US"),
last_forecast_date = "2021-03-08",
forecast_date_window_size = 0,
locations = c("GB"),
targets = paste(1:4, "wk ahead inc death"),
source = "zoltar"
)
#> get_token(): POST: https://zoltardata.com/api-token-auth/
#> get_resource(): GET: https://zoltardata.com/api/projects/
#> get_resource(): GET: https://zoltardata.com/api/project/238/models/
#> get_resource(): GET: https://zoltardata.com/api/project/238/timezeros/
load_latest_forecasts(
models = "Columbia_UNC-SurvCon",
last_forecast_date = "2021-01-03",
source = "zoltar",
as_of = "2021-01-04",
verbose = FALSE,
location = "US"
)
#> get_token(): POST: https://zoltardata.com/api-token-auth/
#> get_resource(): GET: https://zoltardata.com/api/projects/
#> get_resource(): GET: https://zoltardata.com/api/project/44/models/
#> get_resource(): GET: https://zoltardata.com/api/project/44/timezeros/
#> # A tibble: 448 × 16
#> model forecast_date location horizon temporal_resolution target_variable
#> <chr> <date> <chr> <chr> <chr> <chr>
#> 1 Columbia_… 2021-01-03 US 1 wk cum death
#> 2 Columbia_… 2021-01-03 US 1 wk cum death
#> 3 Columbia_… 2021-01-03 US 1 wk cum death
#> 4 Columbia_… 2021-01-03 US 1 wk cum death
#> 5 Columbia_… 2021-01-03 US 1 wk cum death
#> 6 Columbia_… 2021-01-03 US 1 wk cum death
#> 7 Columbia_… 2021-01-03 US 1 wk cum death
#> 8 Columbia_… 2021-01-03 US 1 wk cum death
#> 9 Columbia_… 2021-01-03 US 1 wk cum death
#> 10 Columbia_… 2021-01-03 US 1 wk cum death
#> # ℹ 438 more rows
#> # ℹ 10 more variables: target_end_date <date>, type <chr>, quantile <dbl>,
#> # value <dbl>, location_name <chr>, population <dbl>, geo_type <chr>,
#> # geo_value <chr>, abbreviation <chr>, full_location_name <chr>