% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/forecasts.R
\name{get_forecasts}
\alias{get_forecasts}
\title{Get OBR forecast history for a fiscal series}
\usage{
get_forecasts(series = "PSNB", refresh = FALSE)
}
\arguments{
\item{series}{Character. The series to return. Use
\code{\link[=list_forecast_series]{list_forecast_series()}} to see all options. Defaults to
\code{"PSNB"} (Public Sector Net Borrowing in \enc{£}{GBP} billion).}

\item{refresh}{Logical. If \code{TRUE}, re-download even if a cached copy exists.
Defaults to \code{FALSE}.}
}
\value{
An \code{obr_tbl} with the standard v0.4.0 schema plus a
\code{forecast_date} column (so each row identifies one fiscal-year value at
one fiscal event):
\describe{
\item{forecast_date}{When the forecast was published, e.g. \code{"March 2024"}}
\item{period}{Fiscal year being forecast, e.g. \code{"2024-25"}}
\item{period_type}{Always \code{"fiscal_year"}}
\item{series}{Series name as supplied (character)}
\item{metric_type}{One of \code{"level"}, \code{"pct"}, \code{"yoy_pct"}, set per
series. CPI / GDP / real_GDP are \code{"yoy_pct"} (rates of change);
PSNB / receipts / expenditure are \code{"level"}; the \verb{_pct} variants and
PSND are \code{"pct"} (\% of GDP).}
\item{value}{Numeric forecast value in the unit described by \code{unit}}
\item{unit}{\code{"gbp_bn"} for level series, \code{"pct"} for percentage series}
}
}
\description{
Downloads (and caches) the OBR Historical Official Forecasts Database and
returns a tidy long-format data frame showing every forecast the OBR has
ever published for a given series. Each row is one forecast for one fiscal
year, made at one fiscal event.
}
\details{
This is useful for visualising how OBR forecasts have evolved over time,
and for comparing forecasts against outturns. The vintage of the underlying
database is recorded in the returned object's provenance.
}
\examples{
\donttest{
op <- options(obr.cache_dir = tempdir())
try({
  get_forecasts("PSNB")

  psnb <- get_forecasts("PSNB")
  psnb[psnb$period == "2024-25", ]
})
options(op)
}

}
\seealso{
Other forecasts: 
\code{\link{get_forecast_revisions}()},
\code{\link{list_forecast_series}()},
\code{\link{obr_actual_vs_forecast}()},
\code{\link{obr_compare_vintages}()},
\code{\link{obr_forecast_panel}()}
}
\concept{forecasts}
