Skip to contents

Generic fetcher that takes an EFO table identifier (e.g. "6.5", "1.7", "4.1") and returns the parsed contents in the standard v0.4.0 schema. Use obr_efo_catalogue() to discover which tables are available.

Usage

get_efo_table(table_id, vintage = NULL, refresh = FALSE)

Arguments

table_id

Character. The EFO table identifier, e.g. "6.5", "1.7", "6.13". See obr_efo_catalogue() for the full list.

vintage

Optional EFO vintage label (e.g. "October 2024"). If NULL, uses any pin set via obr_pin() or falls back to the latest live EFO.

refresh

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

Value

An obr_tbl with the standard v0.4.0 schema columns (period, period_type, series, metric_type, value, unit). Returns NULL (with a warning) for cross-reference sheets.

Details

Internally, this function looks up table_id in the catalogue, fetches the right workbook (Aggregates or Economy), dispatches to a layout- specific parser, and tags every row with metric_type and unit according to the catalogue's defaults plus per-row classification.

Coverage today: 17 fiscal Aggregates tables + 22 macro Economy tables. One sheet (6.11 PSND year-on-year changes) is a cross-reference to a previous EFO and returns NULL with a warning rather than data; OBR itself directs users to the previous EFO for that table.

Headline functions get_efo_fiscal() and get_efo_economy() are kept as thin wrappers over this dispatcher.

Examples

# \donttest{
op <- options(obr.cache_dir = tempdir())
try({

  # Net borrowing components (same data as get_efo_fiscal())
  get_efo_table("6.5")

  # CPI category inflation by year
  get_efo_table("1.19")

  # Composition of public sector net debt
  get_efo_table("6.13")

  # Pin to a specific vintage
  get_efo_table("6.5", vintage = "October 2024")
})
#>  Loading from cache. Use `refresh = TRUE` to re-download.
#>  Loading from cache. Use `refresh = TRUE` to re-download.
#>  Loading from cache. Use `refresh = TRUE` to re-download.
#>  Loading from cache. Use `refresh = TRUE` to re-download.
#> # obr_tbl: 56 rows x 6 cols
#> # Source:       OBR Economic and Fiscal Outlook, October 2024
#> # URL:          https://obr.uk/download/october-2024-economic-and-fiscal-outlook-detailed-forecast-tables-aggregates/
#> # Retrieved:    2026-08-23 18:04:59 UTC
#> # File MD5:     e647b168d466
#> # Package:      obr 0.6.2
#> 
#>     period period_type              series metric_type    value   unit
#> 1  2023-24 fiscal_year    Current receipts       level 1100.811 gbp_bn
#> 2  2024-25 fiscal_year    Current receipts       level 1148.687 gbp_bn
#> 3  2025-26 fiscal_year    Current receipts       level 1229.480 gbp_bn
#> 4  2026-27 fiscal_year    Current receipts       level 1290.534 gbp_bn
#> 5  2027-28 fiscal_year    Current receipts       level 1345.979 gbp_bn
#> 6  2028-29 fiscal_year    Current receipts       level 1389.767 gbp_bn
#> 7  2029-30 fiscal_year    Current receipts       level 1439.914 gbp_bn
#> 8  2023-24 fiscal_year Current expenditure       level 1087.805 gbp_bn
#> 9  2024-25 fiscal_year Current expenditure       level 1134.438 gbp_bn
#> 10 2025-26 fiscal_year Current expenditure       level 1182.846 gbp_bn
#> # ... with 46 more rows
options(op)
# }