
Get Indonesia's Total Population from World Bank
Source:R/get_indonesia_population.R
get_indonesia_population.RdRetrieves Indonesia's total population for the years 2010 to 2022
using the World Bank Open Data API. The indicator used is SP.POP.TOTL.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SP.POP.TOTL
Value
A tibble with:
indicator: Indicator name.country: Country name ("Indonesia").year: Year (integer).value: Population (numeric).value_label: Formatted population (e.g., "126,000,000").
Returns NULL if API request fails or data is unavailable.
Details
If the API request fails for any reason (network issue, timeout,
invalid HTTP status, or malformed JSON), the function returns NULL
with an informative message.
Examples
# \donttest{
get_indonesia_population()
#> # A tibble: 13 × 5
#> indicator country year value value_label
#> <chr> <chr> <int> <int> <chr>
#> 1 Population, total Indonesia 2022 278830529 278,830,529
#> 2 Population, total Indonesia 2021 276758053 276,758,053
#> 3 Population, total Indonesia 2020 274814866 274,814,866
#> 4 Population, total Indonesia 2019 272489381 272,489,381
#> 5 Population, total Indonesia 2018 269951846 269,951,846
#> 6 Population, total Indonesia 2017 267346658 267,346,658
#> 7 Population, total Indonesia 2016 264627418 264,627,418
#> 8 Population, total Indonesia 2015 261799249 261,799,249
#> 9 Population, total Indonesia 2014 258877399 258,877,399
#> 10 Population, total Indonesia 2013 255852467 255,852,467
#> 11 Population, total Indonesia 2012 252698525 252,698,525
#> 12 Population, total Indonesia 2011 249470032 249,470,032
#> 13 Population, total Indonesia 2010 246305322 246,305,322
# }