
Get Indonesia's GDP (Current US$) from World Bank
Source:R/get_indonesia_gdp.R
get_indonesia_gdp.RdRetrieves Indonesia's Gross Domestic Product (GDP) in current US dollars
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is NY.GDP.MKTP.CD.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/NY.GDP.MKTP.CD
Value
A tibble with the following columns:
indicator: Indicator name (e.g., "GDP (current US$)")country: Country name ("Indonesia")year: Year of the data (integer)value: GDP value in numeric formvalue_label: Formatted GDP value (e.g., "1,466,464,899,304")
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_gdp()
#> # A tibble: 13 × 5
#> indicator country year value value_label
#> <chr> <chr> <int> <dbl> <chr>
#> 1 GDP (current US$) Indonesia 2022 1.32e12 1,319,101,183,380
#> 2 GDP (current US$) Indonesia 2021 1.19e12 1,186,509,691,087
#> 3 GDP (current US$) Indonesia 2020 1.06e12 1,059,054,842,698
#> 4 GDP (current US$) Indonesia 2019 1.12e12 1,119,099,871,350
#> 5 GDP (current US$) Indonesia 2018 1.04e12 1,042,271,532,989
#> 6 GDP (current US$) Indonesia 2017 1.02e12 1,015,618,744,160
#> 7 GDP (current US$) Indonesia 2016 9.32e11 931,877,364,038
#> 8 GDP (current US$) Indonesia 2015 8.61e11 860,854,232,686
#> 9 GDP (current US$) Indonesia 2014 8.91e11 890,814,755,534
#> 10 GDP (current US$) Indonesia 2013 9.13e11 912,524,136,718
#> 11 GDP (current US$) Indonesia 2012 9.18e11 917,869,913,333
#> 12 GDP (current US$) Indonesia 2011 8.93e11 892,969,104,563
#> 13 GDP (current US$) Indonesia 2010 7.55e11 755,094,157,622
# }