Learn R Programming

JapanAPIs

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.

Installation

You can install the JapanAPIs package from CRAN with the following R function:


install.packages("JapanAPIs")

Usage

After installation, load the package and start exploring and using its functions and datasets.


library(JapanAPIs)

JapanAPIs Functions

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

Dataset Suffixes

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.

Datasets Included in JapanAPIs

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.

Example Code:


# 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)

Copy Link

Version

Install

install.packages('JapanAPIs')

Monthly Downloads

161

Version

0.1.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Renzo Caceres Rossi

Last Published

November 30th, 2025

Functions in JapanAPIs (0.1.1)

japan_population_tbl_df

Japan Population Data
jpn_suicides_tbl_df

Suicides in Japan by Sex and Age (1978–2022)
japan_birth_stats_tbl_df

Japan Birth Demographics
jpn_us_cars_df

Attributes of Some US and Japanese Automobiles
japan_universities_tbl_df

Japanese Universities
jpn_usd_exchange_df

Yen-Dollar Exchange Rate (Weekly, 1975–1989)
jpn_climate_tbl_df

Climate Data in Japan
get_japan_unemployment

Get Japan's Unemployment Rate from World Bank
hiroshima_tbl_df

Hiroshima Atomic Bomb Survivors Cancer Data
jpn_climate_stations_tbl_df

Climate Stations in Japan
japanese_whisky_tbl_df

Japanese Whisky Review Dataset
jpn_gdp_cons_df

Household Consumption and GDP in Japan (1978–2007)
seishu_wine_df

The Seishu Wine Study
jpn_eq_miyagi_2003_df

July 26, 2003 N. Miyagi Earthquake Aftershocks
get_japan_holidays

Get Official Public Holidays in Japan for a Given Year
shinkansen_stations_tbl_df

Shinkansen Stations in Japan
get_japan_gdp

Get Japan's GDP (Current US$) from World Bank
get_japan_population

Get Japan's Total Population from World Bank
jpn_vehicle_prod_ts

Japanese Motor Vehicle Production (1947–1989)
tokyo_wards_tbl_df

Special Wards of Tokyo
tokyo_rainfall_vec

Tokyo Rainfall Data
tokaido_stations_tbl_df

East Japan Railway's Tokaido Line Stations
jpnprefs_tbl_df

Prefectural Informations in Japan
kobe_quake_1995_ts

1995 Kobe Earthquake Data
toyota_stock_prices_df

Toyota Stock Prices
sake_ratings_df

Taste Ratings of Japanese Rice Wine (Sake)
nikkei_stock_index_df

Japanese NIKKEI Stock Index
jpn_prefectures_tbl_df

Japan Prefectures 7x7 Grid Dataset
life_exp_japan_tbl_df

Japan Life Expectancy and Socioeconomic Indicators (2020)
view_datasets_JapanAPIs

View Available Datasets in JapanAPIs
kojima_tweets_tbl_df

Kojima Hideo Tweets (Japanese)
jpn_manga_hafu_df

Half-Caste Manga Characters
JapanAPIs

JapanAPIs: Access Japanese Data via Public APIs and Curated Datasets
get_japan_cpi

Get Japan's Consumer Price Index from World Bank
atomic_bomb_survivors_df

Japanese Atomic Bomb Survivors
J1League_tbl_df

Japanese J1 League Results
get_japan_energy_use

Get Japan's Energy Use (kg of oil equivalent per capita) from World Bank
centenarian_df

Japanese Centenarians Data
get_japan_child_mortality

Get Under-5 Mortality Rate in Japan from World Bank
earthquake_station_sf

Earthquake Observation Stations in Japan
get_country_info_jp

Get Key Country Information About Japan from the REST Countries API
JNcharacter_df

Japanese National Character Survey Sample
get_japan_literacy_rate

Get Japan's Literacy Rate (Age 15+) from World Bank
get_japan_life_expectancy

Get Japan's Life Expectancy at Birth from World Bank
get_japan_hospital_beds

Get Hospital Beds per 1,000 People in Japan from World Bank