BOJ

R Interface to Bank of Japan Statistics

https://github.com/stefanangrick/boj

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

R Interface to Bank of Japan Statistics

Basic Info
  • Host: GitHub
  • Owner: stefanangrick
  • License: other
  • Language: R
  • Default Branch: master
  • Size: 469 KB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created about 6 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.Rmd

---
title: "BOJ"
output:
  github_document:
    fig_width: 8
    fig_height: 4
---

[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/BOJ)](https://cran.r-project.org/package=BOJ) [![Cranlogs Downloads](https://cranlogs.r-pkg.org/badges/grand-total/BOJ)](https://cran.r-project.org/package=BOJ)

The `BOJ` package provides an `R` interface to [Bank of Japan](https://www.boj.or.jp/) statistics, specifically the [flat files](https://www.stat-search.boj.or.jp/info/dload_en.html) available on the [BOJ Time-Series Data](https://www.stat-search.boj.or.jp/) portal.

## Installing the package

You can install the package from CRAN or GitHub.

```{r install, eval=FALSE, message=FALSE, warning=FALSE}
library(devtools)
install_github("stefanangrick/BOJ")  # GitHub
install.packages("BOJ")              # CRAN
```

## Example usage

To start using the package, load it into your R session.

```{r loading, message=FALSE, warning=FALSE}
library("BOJ")
```

Next, retrieve a list of available data sets using the `get_boj_datasets()` function.

```{r datasets, message=FALSE, warning=FALSE}
ds <- get_boj_datasets()
head(ds)
```

The `get_boj_datasets()` function returns a [tibble](https://tibble.tidyverse.org/) data frame listing available data sets. Use the `url` column as input for the `get_boj()` function to download, parse, and import the corresponding data set.

For example, to import monthly-frequency data on Japan's [Services Producer Price Index](https://www.boj.or.jp/en/statistics/pi/sppi_2015/index.htm), use the following code:

```{r sppi, message=FALSE, warning=FALSE}
sppi <- get_boj(ds$url[(ds$name == "sppi_m_en")])
head(sppi)
```

To plot the data with [ggplot2](https://ggplot2.tidyverse.org), run the following:

```{r plot, message=FALSE, warning=FALSE}
library("dplyr")
library("ggplot2")
library("zoo")

sppi_plot <- subset(sppi, code %in% c("PRCS20_5200000000", "PRCS20_5200010001",
                                      "PRCS20_5200010002", "PRCS20_5200010003",
                                      "PRCS20_5200010004", "PRCS20_5200010005",
                                      "PRCS20_5200010006", "PRCS20_5200010007"))
sppi_plot <- mutate(sppi_plot, date = as.Date(as.yearmon(date, format = "%Y%m")))
sppi_plot <- mutate(sppi_plot, struc = gsub("^Major group/ ", "", struc))
sppi_plot <- subset(sppi_plot, !is.na(obs_value))

ggplot(sppi_plot, aes(x = date, y = obs_value)) +
  geom_line(aes(colour = struc)) +
  labs(title = "Services Producer Price Index", x = "Date", y = "Index") +
  theme(legend.title = element_blank())
```

Note that BOJ data sets use various time formats. The [zoo](https://cran.r-project.org/package=zoo) package (e.g., `as.yearmon()`) can handle most of these formats.

## Retrieving individual data series

To retrieve individual data series instead of full data sets, consider using the [BOJfame](https://github.com/stefanangrick/BOJfame) package.

## Note

This package is neither officially related to nor endorsed by the [Bank of Japan](https://www.boj.or.jp/). Please avoid overloading the BOJ servers with unnecessary requests.

Owner

  • Login: stefanangrick
  • Kind: user

GitHub Events

Total
  • Push event: 5
Last Year
  • Push event: 5

Packages

  • Total packages: 1
  • Total downloads:
    • cran 307 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: BOJ

Interface to Bank of Japan Statistics

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 307 Last month
Rankings
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 37.8%
Downloads: 48.1%
Maintainers (1)
Last synced: 10 months ago