boj_layer: Retrieve Bank of Japan time-series data by hierarchy

View source: R/data.R

boj_layerR Documentation

Retrieve Bank of Japan time-series data by hierarchy

Description

Uses the BOJ layer API to retrieve all series matching a database hierarchy and frequency. The function follows NEXTPOSITION automatically. A layer condition that identifies more than 1,250 series is rejected by the BOJ API; this count is evaluated before the frequency filter.

Usage

boj_layer(
  db,
  frequency,
  layer,
  start_date = NULL,
  end_date = NULL,
  lang = boj_default("lang", "en"),
  wide = FALSE,
  wait = boj_default("wait", 1),
  timeout = boj_default("timeout", 30),
  retries = boj_default("retries", 3)
)

Arguments

db

BOJ database identifier.

frequency

One of "CY", "FY", "CH", "FH", "Q", "M", "W", or "D".

layer

One to five hierarchy values supplied as a vector or a comma-separated string. "*" is a wildcard; for example, c(1, "*", 2).

start_date, end_date

Optional BOJ period codes. Accepted request forms are YYYY or YYYYPP; daily and weekly filters also use YYYYMM.

lang

Response language, "en" or "jp".

wide

If FALSE (default), return normalized long data. If TRUE, return time, parsed date, and one column per code or alias.

wait

Requested seconds between automatic requests. The default is one second, and values below one are treated as one whenever another request is needed, to avoid high-frequency access prohibited by the BOJ.

timeout

Request timeout in seconds.

retries

Number of retries for network and transient server errors.

Value

A long or wide tibble with the same structure as boj_data().

Examples

## Not run: 
boj_layer(
  db = "BP01", frequency = "M", layer = c(1, 1, 1),
  start_date = "202504", end_date = "202509"
)

## End(Not run)

bojapi documentation built on July 24, 2026, 5:07 p.m.