View source: R/load_forecasts.R
load_forecasts | R Documentation |
If date_window_size
is 0, this function returns all available forecasts
submitted on every day in dates
.
Ifdate_window_size
is not 0, this function will look for the latest
forecasts that are submitted within window size for each day in dates
.
If source
is local_zoltar
, a valid sqlite3 object is required.
Please follow the instruction in load_forecasts_local_zoltar()
to set up
required environment.
load_forecasts(
models = NULL,
dates = NULL,
date_window_size = 0,
locations = NULL,
types = NULL,
targets = NULL,
source = "zoltar",
hub_repo_path,
local_zoltpy_path,
zoltar_sqlite_file,
data_processed_subpath = "data-processed/",
as_of = NULL,
hub = c("US", "ECDC", "FluSight"),
verbose = TRUE
)
models |
Character vector of model abbreviations. Default all models that submitted forecasts meeting the other criteria. |
dates |
The forecast date of forecasts to retrieve. A vector of one or more Date objects or character strings in format “YYYY-MM-DD” Default to all valid forecast dates. |
date_window_size |
The number of days across each date in |
locations |
a vector of strings of fips code or CBSA codes or location names,
such as "Hampshire County, MA", "Alabama", "United Kingdom".
A US county location names must include state abbreviation.
Default to |
types |
Character vector specifying type of forecasts to load: |
targets |
character vector of targets to retrieve, for example
|
source |
string specifying where forecasts will be loaded from: one of
|
hub_repo_path |
path to local clone of the forecast hub repository |
local_zoltpy_path |
path to local clone of zolpy repository.
Only needed when |
zoltar_sqlite_file |
path to local sqlite file,
either a relative path w.r.t. |
data_processed_subpath |
folder within the hub_repo_path that contains
forecast submission files. Default to |
as_of |
character for date time to load forecasts submitted as of this time from Zoltar.
Ignored if |
hub |
character vector, where the first element indicates the hub
from which to load forecasts. Possible options are |
verbose |
logical to print out diagnostic messages. Default is |
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
# Load forecasts from US forecast hub
# This call only loads the latest forecast submitted on "2021-07-26" in
# a 12-day window w.r.t "2021-7-30".
load_forecasts(
models = "COVIDhub-ensemble",
dates = "2021-07-30",
date_window_size = 11,
locations = "US",
types = c("point", "quantile"),
targets = paste(1:4, "wk ahead inc case"),
source = "zoltar",
verbose = FALSE,
as_of = NULL
)
# Load forecasts from ECDC forecast hub
# This function call loads the latest forecasts in each 2-day window
# w.r.t "2021-03-08" and "2021-07-27".
load_forecasts(
models = "ILM-EKF",
hub = c("ECDC", "US"),
dates = c("2021-03-08", "2021-07-27"),
date_window_size = 1,
locations = "GB",
targets = paste(1:4, "wk ahead inc death"),
source = "zoltar"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.