R/load_latest_forecasts_zoltar.R

Defines functions load_latest_forecasts_zoltar

Documented in load_latest_forecasts_zoltar

#' Load the most recent forecasts of all that were submitted
#' on `forecast_dates` from Zoltar.
#'
#' This function will throw a warning and return an empty data frame when
#' no forecasts are submitted on any dates in `forecast_dates` for selected `models`,
#' `locations`, `types` and `target`.
#'
#' \Sexpr[results=rd, stage=render]{lifecycle::badge("deprecated")}
#' Please use [load_forecasts_zoltar()] instead.
#'
#' @inheritParams load_forecasts_zoltar
#'
#' @export
load_latest_forecasts_zoltar <- function(models = NULL,
                                         forecast_dates = NULL,
                                         locations = NULL,
                                         types = NULL,
                                         targets = NULL,
                                         as_of = NULL,
                                         hub = c("US", "ECDC"),
                                         verbose = TRUE) {
  lifecycle::deprecate_warn("0.1.5",
    "load_latest_forecasts_zoltar()",
    details =
      "This function has been superseded by the latest load_forecasts_zoltar(). Please switch your code to using the new function."
  )

  
  if (!is.null(forecast_dates)){
    forecast_dates <- list(forecast_dates)
  }
  
  forecast <- load_forecasts_zoltar(
    models = models,
    forecast_dates = forecast_dates,
    locations = locations,
    types = types,
    targets = targets,
    as_of = as_of,
    verbose = verbose,
    hub = hub
  )

  return(forecast)
}
reichlab/covidHubUtils documentation built on Feb. 6, 2024, 1:42 p.m.