Type: Package
Title: Interface to Bank of Japan Statistics
Version: 0.3.4
Description: Provides an interface to Bank of Japan https://www.boj.or.jp statistics.
License: MIT + file LICENSE
URL: https://github.com/stefanangrick/BOJ
BugReports: https://github.com/stefanangrick/BOJ/issues
Suggests: knitr, rmarkdown, ggplot2, zoo
Imports: dplyr, readr, tidyr, tidyselect, rvest, xml2
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-01-02 08:05:31 UTC; qwerty
Author: Stefan Angrick [aut, cre, cph]
Maintainer: Stefan Angrick <contact@stefanangrick.net>
Repository: CRAN
Date/Publication: 2025-01-19 11:10:02 UTC

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)