boj_search: Search Bank of Japan series metadata

View source: R/metadata.R

boj_searchR Documentation

Description

Searches current BOJ metadata in the same spirit as WDI::WDIsearch(). Supply a database to fetch/cache metadata, or pass a metadata tibble directly for an offline or reproducible search.

Usage

boj_search(
  pattern,
  db = NULL,
  fields = c("series_code", "name", "category", "notes"),
  regex = FALSE,
  ignore_case = TRUE,
  metadata = NULL,
  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 = FALSE,
  wait = boj_default("wait", 1),
  timeout = boj_default("timeout", 30),
  retries = boj_default("retries", 3)
)

Arguments

pattern

One non-empty search string or regular expression.

db

One or more database identifiers. Not needed when metadata is supplied.

fields

Metadata columns to search. Defaults to series code, name, category, and notes.

regex

Treat pattern as a regular expression. The default performs a literal substring search.

ignore_case

Ignore letter case.

metadata

Optional data frame returned by boj_metadata() or boj_cache().

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 matching hierarchy-heading rows.

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 filtered metadata tibble.

Examples

## Not run: 
boj_search("U.S. Dollar", db = "FM08")
boj_search("FXERM07", db = "FM08", lang = "jp")
boj_search("exchange|euro", db = "FM08", regex = TRUE)

## End(Not run)

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