load_truth() and pivot_forecasts_wider()R/get_plot_forecast_data.R
get_plot_forecast_data.RdCombine load_truth() and pivot_forecasts_wider()
get_plot_forecast_data(
forecast_data,
truth_data = NULL,
models_to_plot,
forecast_dates_to_plot,
horizons_to_plot,
quantiles_to_plot,
locations_to_plot = NULL,
plot_truth = TRUE,
truth_source,
target_variable_to_plot,
truth_as_of = NULL,
hub = c("US", "ECDC", "FluSight")
)required data.frame with forecasts in the format returned
by load_forecasts().
It has columns model, forecast_date, location, target, type, quantile,
value, horizon and target_end_date.
optional data.frame from one truth source in the format returned
by load_truth(). It needs to have columns model, target_variable,
target_end_date, location and value.
Model column can be "Observed Data (a truth source)".
characters of model abbreviations
date string vectors for forecast dates to plot.
Default to all forecast dates available in forecast_data.
forecasts are plotted for the horizon time steps after the forecast date.
vector of quantiles to include in the plot
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 NULL which would include all locations available in forecast_data.
logical to indicate whether truth data should be plotted.
Default to TRUE.
character specifying where the truth data will
be loaded from if truth_data is not provided. Currently support "JHU",
NYTimes" and "HealthData".
Optional if truth_data is provided.
string specifying target type. It should be one of
"cum death", "inc case", "inc death", "inc hosp" and "inc flu hosp".
the plot includes the truth data that would have been
in real time as of the truth_as_of date.
character, which hub to use. Default is "US".
Other options are "ECDC" and "FluSight".
data.frame with columns model,
forecast_date, location, target_variable, type, quantile, value,
horizon and target_end_date.