Provides functions to access data from public RESTful APIs including 'Nager.Date', 'World Bank API', and 'REST Countries API', retrieving real-time or historical data related to Japan, such as holidays, economic indicators, and international demographic and geopolitical indicators. Additionally, the package includes one of the largest curated collections of open datasets focused on Japan, covering topics such as natural disasters, economic production, vehicle industry, air quality, demographics, and administrative divisions. The package supports reproducible research and teaching by integrating reliable international APIs and structured datasets from public, academic, and government sources. For more information on the APIs, see: 'Nager.Date' < https://date.nager.at/Api>, 'World Bank API' < https://datahelpdesk.worldbank.org/knowledgebase/articles/889392>, and 'REST Countries API' < https://restcountries.com/>.
The JapanAPIs package provides a unified interface to access open data from the World Bank API, Nager.Date API, and the REST Countries API, with a focus on Japan. It allows users to retrieve up-to-date or historical information on topics such as economic indicators, population statistics, national holidays, and basic geopolitical details.
In addition to API-access functions, the package includes one of the largest curated collections of open datasets related to Japan. These datasets cover a wide range of topics including natural disasters, economic production, the vehicle industry, air quality, demographic trends, and administrative divisions.
You can install the JapanAPIs package from CRAN with the following R function:
install.packages("JapanAPIs")
After installation, load the package and start exploring and using its functions and datasets.
library(JapanAPIs)
Below is a list of the main functions included in the package:
get_japan_child_mortality(): Get Under-5 Mortality Rate in Japan from World Bank
get_japan_cpi(): Get Japan's Consumer Price Index from World Bank
get_japan_energy_use(): Get Japan's Energy Use (kg of oil equivalent per capita) from World Bank
get_japan_gdp(): Get Japan's GDP (Current US$) from World Bank
get_japan_holidays(): Get official public holidays in Japan for a given year, e.g. get_japan_holidays(2025)
get_japan_hospital_beds(): Get Hospital Beds per 1,000 People in Japan from World Bank
get_japan_life_expectancy(): Get Japan's Life Expectancy at Birth from World Bank
get_japan_literacy_rate(): Get Japan's Literacy Rate (Age 15+) from World Bank
get_japan_population(): Get Japan's Total Population from World Bank
get_japan_unemployment(): Get Japan's Unemployment Rate from World Bank
get_country_info_jp(): Get Key Country Information About Japan from the REST Countries API
view_datasets_JapanAPIs(): View Available Datasets in JapanAPIs
Each dataset in JapanAPIs is labeled with a suffix to indicate its structure and type:
_df: A standard data frame.
_tbl_df: A tibble data frame object.
_ts: A time series object.
_vec: A numeric vector object.
In addition to API access functions, JapanAPIs offers one of the largest curated collections of open datasets focused on Japan. These preloaded datasets cover a wide range of topics including demography, natural disasters, public health, sports, centenarians, atomic bomb survivors, earthquakes, and administrative data. Below are some featured examples:
jpn_usd_exchange_df: A Data frame containing weekly observations of the yen-dollar exchange rate from 1975 to 1989.
jpn_prefectures_tbl_df: A tibble representing Japan’s 47 prefectures arranged in a 7x7 grid layout.
kobe_quake_1995_ts: A time series containing data related to the 1995 Kobe earthquake.
# Load the package
library(JapanAPIs)
# Retrieves essential information about Japan
get_country_info_jp()
# Get Japan's Population (Total) from World Bank
get_japan_population()
# Load a dataset
data(japan_population_tbl_df)
# Shows six rows of the dataset
head(japan_population_tbl_df)
# Display the structure of the dataset
str(japan_population_tbl_df)
# Shows the whole dataset
View(japan_population_tbl_df)