
Get Indonesia's Consumer Price Index from World Bank
Source:R/get_indonesia_cpi.R
get_indonesia_cpi.RdRetrieves Indonesia'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.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/FP.CPI.TOTL
Value
A tibble with the following columns:
indicator: Indicator name (e.g., "Consumer price index (2010 = 100)")country: Country name ("Indonesia")year: Year of the data (integer)value: Consumer Price Index value in numeric form
Returns NULL if the API is unavailable or returns an error.
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.
Examples
# \donttest{
get_indonesia_cpi()
#> # A tibble: 13 × 4
#> indicator country year value
#> <chr> <chr> <int> <dbl>
#> 1 Consumer price index (2010 = 100) Indonesia 2022 163.
#> 2 Consumer price index (2010 = 100) Indonesia 2021 156.
#> 3 Consumer price index (2010 = 100) Indonesia 2020 154.
#> 4 Consumer price index (2010 = 100) Indonesia 2019 151.
#> 5 Consumer price index (2010 = 100) Indonesia 2018 147.
#> 6 Consumer price index (2010 = 100) Indonesia 2017 142.
#> 7 Consumer price index (2010 = 100) Indonesia 2016 137.
#> 8 Consumer price index (2010 = 100) Indonesia 2015 132.
#> 9 Consumer price index (2010 = 100) Indonesia 2014 124.
#> 10 Consumer price index (2010 = 100) Indonesia 2013 117.
#> 11 Consumer price index (2010 = 100) Indonesia 2012 110.
#> 12 Consumer price index (2010 = 100) Indonesia 2011 105.
#> 13 Consumer price index (2010 = 100) Indonesia 2010 100
# }