% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/policy_measures.R
\name{get_policy_measures}
\alias{get_policy_measures}
\title{Get OBR policy measures by fiscal event}
\usage{
get_policy_measures(
  type = c("tax", "spending"),
  search = NULL,
  since = NULL,
  refresh = FALSE
)
}
\arguments{
\item{type}{Character vector. Which measures to return: \code{"tax"},
\code{"spending"}, or both (the default).}

\item{search}{Optional character. A regular expression used to filter
\code{measure} and \code{head} (case-insensitive). For example,
\code{search = "alcohol"} keeps any measure whose description or head
mentions alcohol.}

\item{since}{Optional fiscal-year cut-off (e.g. \code{"2020-21"}). Rows whose
\code{fiscal_year} is earlier are dropped.}

\item{refresh}{Logical. If \code{TRUE}, re-download even if a cached copy
exists. Defaults to \code{FALSE}.}
}
\value{
An \code{obr_tbl} with columns:
\describe{
\item{event}{Fiscal event that scored the measure, e.g. \code{"Budget 2024"} (character)}
\item{measure}{Plain-English description of the measure (character)}
\item{head}{Tax head (for tax measures) or spending head (character)}
\item{fiscal_year}{Fiscal year being scored, e.g. \code{"2024-25"} (character)}
\item{value_mn}{Exchequer effect in GBP million. For tax measures, a
positive value raises revenue; for spending measures, a positive
value increases spending (numeric)}
}
}
\description{
Downloads (and caches) the OBR Policy Measures Database, a single workbook
that lists every tax or spending measure scored at a UK fiscal event,
with the Exchequer effect in GBP million for each year of the forecast
horizon. Tax measures cover 1970 to date; spending measures cover 2010
to date.
}
\details{
This is the only programmatic access to the PMD: the OBR otherwise
distributes it as a single Excel file.
}
\examples{
\donttest{
op <- options(obr.cache_dir = tempdir())

# The OBR CDN occasionally rate-limits or returns 403 to repeated
# requests. tryCatch so the example degrades gracefully if that happens
# during the CRAN check.
oct24 <- tryCatch(get_policy_measures(),
                  error = function(e) NULL)
if (!is.null(oct24)) {
  head(oct24[grepl("2024", oct24$event) &
             oct24$fiscal_year == "2025-26", ])

  # All alcohol-duty measures since 2010
  tryCatch(
    get_policy_measures(type = "tax", search = "alcohol",
                        since = "2010-11"),
    error = function(e) NULL
  )
}

options(op)
}

}
\seealso{
Other policy measures: 
\code{\link{policy_measures_summary}()}
}
\concept{policy measures}
