Package 'BOJ'

Title: Interface to Bank of Japan Statistics
Description: Provides an interface to Bank of Japan <https://www.boj.or.jp> statistics.
Authors: Stefan Angrick [aut, cre, cph]
Maintainer: Stefan Angrick <[email protected]>
License: MIT + file LICENSE
Version: 0.3.4
Built: 2025-01-21 13:20:34 UTC
Source: CRAN

Help Index


Download and parse a BOJ data set

Description

Download and parse a BOJ data set

Usage

get_boj(item_url, auto_pivot = TRUE, ...)

Arguments

item_url

Character. URL of the data set to be imported (usually obtained via get_boj_datasets()).

auto_pivot

Logical. Controls whether source data set is converted to long format. Set this to FALSE to disable conversion (default: TRUE).

...

Arguments passed to download.file() (e.g. quiet = TRUE).

Value

A tibble data frame, or a list of tibble data frames in cases where the source zip file contains multiple csv files.

Examples

ds <- get_boj_datasets()
df <- get_boj(ds$url[(ds$name == "sppi_q_en")])

Retrieve a list of available BOJ data sets

Description

Retrieve a list of available BOJ data sets

Usage

get_boj_datasets(
  base_url = "https://www.stat-search.boj.or.jp/info/dload_en.html"
)

Arguments

base_url

Character. URL of the BOJ's Time-Series Data portal flat files page (optional).

Value

A tibble data frame.

Examples

ds <- get_boj_datasets()

Convert a BOJ data set to long format

Description

Convert a BOJ data set to long format

Usage

pivot_longer_boj(tbl)

Arguments

tbl

Tibble. A tibble data frame containing a BOJ data set (usually obtained via get_boj(item_url, auto_pivot = FALSE)).

Value

A tibble data frame in long format.

Examples

ds   <- get_boj_datasets()
sppi <- get_boj(ds$url[(ds$name == "sppi_q_en")], auto_pivot = FALSE)
sppi <- subset(sppi, code == "PRCS15_52S0000000_CQ")
sppi <- pivot_longer_boj(sppi)