The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The BOJ
package provides an R
interface to
Bank of Japan statistics,
specifically the flat
files available on the BOJ Time-Series Data
portal.
You can install the package from CRAN or GitHub.
To start using the package, load it into your R session.
Next, retrieve a list of available data sets using the
get_boj_datasets()
function.
The get_boj_datasets()
function returns a tibble 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, use the following code:
To plot the data with ggplot2, run the following:
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 package (e.g.,
as.yearmon()
) can handle most of these formats.
To retrieve individual data series instead of full data sets, consider using the BOJfame package.
This package is neither officially related to nor endorsed by the Bank of Japan. Please avoid overloading the BOJ servers with unnecessary requests.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.