Title: Access Office for Budget Responsibility Data
Version: 0.2.2
Description: Provides clean, tidy access to data published by the Office for Budget Responsibility (OBR), the UK's independent fiscal watchdog. Covers the Public Finances Databank (outturn for PSNB, PSND, receipts, and expenditure since 1946), the Historical Official Forecasts Database (every OBR forecast since 2010), the Economic and Fiscal Outlook detailed forecast tables (five-year projections from the latest Budget), the Welfare Trends Report (incapacity benefit spending and caseloads), and the Fiscal Risks and Sustainability Report (50-year state pension projections). Data is downloaded from the OBR on first use and cached locally for subsequent calls. Data is sourced from the OBR website https://obr.uk.
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-GB
URL: https://github.com/charlescoverdale/obr
BugReports: https://github.com/charlescoverdale/obr/issues
RoxygenNote: 7.3.3
Depends: R (≥ 4.1.0)
Imports: httr2, readxl, cli
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-03-09 08:53:37 UTC; charlescoverdale
Author: Charles Coverdale [aut, cre]
Maintainer: Charles Coverdale <charlesfcoverdale@gmail.com>
Repository: CRAN
Date/Publication: 2026-03-12 19:50:02 UTC

Clear cached OBR files

Description

Deletes all files downloaded and cached by the obr package. The next function call will re-download fresh data from the OBR website.

Usage

clear_cache()

Value

Invisibly returns NULL.

Examples


clear_cache()



Get EFO economy projections

Description

Downloads (and caches) the OBR Economic and Fiscal Outlook Detailed Forecast Tables — Economy file and returns quarterly economic projections for a chosen measure in tidy long format.

Usage

get_efo_economy(measure = "inflation", refresh = FALSE)

Arguments

measure

Character. Which economy table to return. One of "labour", "inflation", or "output_gap". Defaults to "inflation".

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

Data runs from 2008 Q1 through the current forecast horizon (OBR, March 2026). Use list_efo_economy_measures to see all available measures.

Value

A data frame with columns:

period

Calendar quarter, e.g. "2025Q1" (character)

series

Variable name, e.g. "CPI" (character)

value

Value in units appropriate to the series (numeric)

Examples


# CPI and RPI since 2008
inf <- get_efo_economy("inflation")
inf[inf$series == "CPI", ]

# Labour market
lab <- get_efo_economy("labour")



Get EFO fiscal projections (net borrowing components)

Description

Downloads (and caches) the OBR Economic and Fiscal Outlook Detailed Forecast Tables — Aggregates file and returns the components of net borrowing (Table 6.5) in tidy long format.

Usage

get_efo_fiscal(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

Covers the five-year forecast horizon published at the most recent Budget (OBR, March 2026). Key series include current receipts, current expenditure, depreciation, net investment, and net borrowing (PSNB).

Value

A data frame with columns:

fiscal_year

Fiscal year being forecast, e.g. "2025-26" (character)

series

Component name, e.g. "Net borrowing" (character)

value_bn

Projected value in £ billion (numeric)

Examples


efo <- get_efo_fiscal()
efo[efo$series == "Net borrowing", ]



Get Total Managed Expenditure

Description

Downloads (and caches) the OBR Public Finances Databank and returns annual Total Managed Expenditure (TME) in £ billion. TME is the broadest measure of UK government spending.

Usage

get_expenditure(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Value

A data frame with columns:

year

Fiscal year (character, e.g. "2024-25")

tme_bn

Total managed expenditure in £ billion (numeric)

Examples


tme <- get_expenditure()
tail(tme)



Get OBR forecast history for a fiscal 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.

Usage

get_forecasts(series = "PSNB", refresh = FALSE)

Arguments

series

Character. The series to return. Use list_forecast_series to see all options. Defaults to "PSNB" (Public Sector Net Borrowing in £bn).

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

This is useful for visualising how OBR forecasts have evolved over time, and for comparing forecasts against outturns.

Value

A data frame with columns:

series

Series name as supplied (character)

forecast_date

When the forecast was published, e.g. "March 2024" (character)

fiscal_year

The fiscal year being forecast, e.g. "2024-25" (character)

value

Forecast value (numeric)

Examples


# All PSNB forecasts
get_forecasts("PSNB")

# What did OBR forecast for 2024-25 PSNB at each Budget?
psnb <- get_forecasts("PSNB")
psnb[psnb$fiscal_year == "2024-25", ]



Get incapacity benefit caseloads

Description

Downloads (and caches) the OBR Welfare Trends Report charts and tables workbook and returns the combined incapacity benefit caseload since 2008-09, in both absolute terms (thousands of claimants) and as a share of the working-age population.

Usage

get_incapacity_caseloads(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Value

A data frame with columns:

year

Fiscal year, e.g. "2023-24" (character)

series

Either "Claimants" (thousands) or "Share of working age population" (per cent) (character)

value

Value in units appropriate to the series (numeric)

Examples


cases <- get_incapacity_caseloads()
# Total claimants
cases[cases$series == "Claimants", ]



Get incapacity benefits spending by type

Description

Downloads (and caches) the OBR Welfare Trends Report charts and tables workbook and returns annual spending on each incapacity benefit as a share of GDP, from 1978-79 to the current forecast horizon.

Usage

get_incapacity_spending(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

Series include: Invalidity Benefit, Incapacity Benefit, Employment and Support Allowance (ESA), Sickness Benefit, and Severe Disablement Allowance.

Value

A data frame with columns:

year

Fiscal year, e.g. "2023-24" (character)

series

Benefit name (character)

value

Spending as a percentage of GDP (numeric)

Examples


ib <- get_incapacity_spending()
unique(ib$series)



Get long-run state pension spending projections

Description

Downloads (and caches) the OBR Fiscal Risks and Sustainability Report executive summary charts and tables workbook and returns 50-year projections for state pension spending as a share of GDP, under alternative demographic and triple-lock uprating scenarios.

Usage

get_pension_projections(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

This data is unique to the Fiscal Risks and Sustainability Report (OBR, July 2025) and is not available in any other OBR publication. It illustrates how ageing demographics and pension uprating rules interact to determine the long-run cost of the state pension.

Value

A data frame with columns:

scenario_type

Either "Demographic scenarios" or "Triple lock scenarios" (character)

scenario

Scenario name, e.g. "Central projection", "Higher life expectancy" (character)

fiscal_year

Fiscal year, e.g. "2030-31" (character)

pct_gdp

State pension spending as a percentage of GDP (numeric)

Examples


proj <- get_pension_projections()

# Central demographic projection over the 50-year horizon
central <- proj[proj$scenario_type == "Demographic scenarios" &
                proj$scenario == "Central projection", ]
tail(central, 10)

# How much more expensive is 'higher life expectancy' vs central?
dem <- proj[proj$scenario_type == "Demographic scenarios", ]



Get Public Sector Net Borrowing (PSNB)

Description

Downloads (and caches) the OBR Public Finances Databank and returns annual Public Sector Net Borrowing in £ billion. A positive value means the government is borrowing (deficit); a negative value means a surplus.

Usage

get_psnb(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Value

A data frame with columns:

year

Fiscal year (character, e.g. "2024-25")

psnb_bn

PSNB in £ billion (numeric)

Examples


psnb <- get_psnb()
tail(psnb)



Get Public Sector Net Debt (PSND)

Description

Downloads (and caches) the OBR Public Finances Databank and returns annual Public Sector Net Debt in £ billion.

Usage

get_psnd(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Value

A data frame with columns:

year

Fiscal year (character, e.g. "2024-25")

psnd_bn

PSND in £ billion (numeric)

Examples


psnd <- get_psnd()
tail(psnd)



Get all Public Finances Databank aggregates

Description

Downloads (and caches) the OBR Public Finances Databank and returns all aggregate fiscal series in tidy long format. Covers outturn from 1946-47 and OBR projections through the current forecast horizon.

Usage

get_public_finances(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

Series include: Public sector net borrowing, Public sector net debt, Total managed expenditure, Public sector current receipts, Nominal GDP, GDP deflator, and more.

Value

A data frame with columns:

year

Fiscal year (character, e.g. "2024-25")

series

Series name (character)

value

Value in £ billion (numeric)

Examples


pf <- get_public_finances()
unique(pf$series)



Get public sector receipts by tax type

Description

Downloads (and caches) the OBR Public Finances Databank and returns public sector current receipts broken down by individual tax type, in tidy long format. Coverage begins in 1999-00.

Usage

get_receipts(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Value

A data frame with columns:

year

Fiscal year (character, e.g. "2024-25")

series

Tax or receipt category (character)

value

Value in £ billion (numeric)

Examples


receipts <- get_receipts()
# Filter to income tax
receipts[grepl("income tax", receipts$series, ignore.case = TRUE), ]



Get working-age welfare spending

Description

Downloads (and caches) the OBR Welfare Trends Report charts and tables workbook and returns annual working-age welfare spending as a share of GDP, split into incapacity-related and non-incapacity spending.

Usage

get_welfare_spending(refresh = FALSE)

Arguments

refresh

Logical. If TRUE, re-download even if a cached copy exists. Defaults to FALSE.

Details

Data cover fiscal years from 1978-79 through the current forecast horizon (OBR, October 2024).

Value

A data frame with columns:

year

Fiscal year, e.g. "2023-24" (character)

series

Spending category: "Working-age incapacity benefits spending" or "Working-age non-incapacity spending" (character)

value

Spending as a percentage of GDP (numeric)

Examples


welfare <- get_welfare_spending()
# Incapacity share since 2000
welfare[welfare$series == "Working-age incapacity benefits spending" &
        welfare$year >= "2000-01", ]



List available EFO economy measures

Description

Returns a data frame of the economy measures available via get_efo_economy, showing the measure name to pass and a short description of what each covers.

Usage

list_efo_economy_measures()

Value

A data frame with columns measure, sheet, and description.

Examples

list_efo_economy_measures()


List available forecast series

Description

Returns a data frame showing the series names accepted by get_forecasts, the corresponding Excel sheet in the OBR Historical Official Forecasts Database, and a plain-English description.

Usage

list_forecast_series()

Value

A data frame with columns series, sheet, and description.

Examples

list_forecast_series()