boj_metadata: Retrieve Bank of Japan series metadata

View source: R/metadata.R

boj_metadataR Documentation

Retrieve Bank of Japan series metadata

Description

Downloads the complete metadata table for one BOJ database. Metadata includes both hierarchy headings (blank series_code) and actual series. By default it is cached for 24 hours, matching the API's daily metadata update cycle and reducing load on the BOJ service.

Usage

boj_metadata(
  db,
  lang = boj_default("lang", "en"),
  cache = TRUE,
  refresh = FALSE,
  max_age = 24 * 60 * 60,
  cache_dir = boj_default("cache_dir", tools::R_user_dir("bojapi", "cache")),
  include_groups = TRUE,
  timeout = boj_default("timeout", 30),
  retries = boj_default("retries", 3),
  wait = boj_default("wait", 1)
)

Arguments

db

BOJ database identifier, such as "FM08".

lang

Response language, "en" or "jp". Japanese responses also contain some English fields, but this function consistently returns the requested language in name, unit, category, and notes.

cache

Whether to read and write the on-disk metadata cache.

refresh

If TRUE, ignore an existing cache entry.

max_age

Maximum cache age in seconds; default 86,400 (24 hours).

cache_dir

Metadata cache directory.

include_groups

Include hierarchy-heading rows whose series_code is blank. These rows are useful when constructing boj_layer() queries.

timeout

Request timeout in seconds.

retries

Number of retries for network and transient server errors.

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.

Value

A tibble with normalized metadata. start_time and end_time preserve exact BOJ period codes. Parsed date columns indicate the first day of each period and are NA for hierarchy headings.

Examples

## Not run: 
metadata <- boj_metadata("FM08", lang = "jp")
subset(metadata, is_series)

## End(Not run)

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