Skip to contents

Retrieves Japan's Consumer Price Index (2010 = 100) for the years 2010 to 2022 using the World Bank Open Data API. The indicator used is FP.CPI.TOTL.

Usage

get_japan_cpi()

Source

World Bank Open Data API: https://data.worldbank.org/indicator/FP.CPI.TOTL

Value

A tibble with the following columns, or NULL if the API is unavailable:

  • indicator: Indicator name (e.g., "Consumer price index (2010 = 100)")

  • country: Country name ("Japan")

  • year: Year of the data (integer)

  • value: Consumer Price Index value in numeric form

Details

The function sends a GET request to the World Bank API. If the API request fails or returns an error status code, the function returns NULL with an informative message.

Note

Requires internet connection. The data is retrieved in real time from the World Bank API.

See also

Examples

# \donttest{
# Requires internet connection
result <- get_japan_cpi()
if (!is.null(result)) {
  print(result)
}
#> # A tibble: 13 × 4
#>    indicator                         country  year value
#>    <chr>                             <chr>   <int> <dbl>
#>  1 Consumer price index (2010 = 100) Japan    2022 108. 
#>  2 Consumer price index (2010 = 100) Japan    2021 105. 
#>  3 Consumer price index (2010 = 100) Japan    2020 105. 
#>  4 Consumer price index (2010 = 100) Japan    2019 105. 
#>  5 Consumer price index (2010 = 100) Japan    2018 105. 
#>  6 Consumer price index (2010 = 100) Japan    2017 104. 
#>  7 Consumer price index (2010 = 100) Japan    2016 103. 
#>  8 Consumer price index (2010 = 100) Japan    2015 104. 
#>  9 Consumer price index (2010 = 100) Japan    2014 103. 
#> 10 Consumer price index (2010 = 100) Japan    2013 100. 
#> 11 Consumer price index (2010 = 100) Japan    2012  99.7
#> 12 Consumer price index (2010 = 100) Japan    2011  99.7
#> 13 Consumer price index (2010 = 100) Japan    2010 100  
# }