Skip to contents

List all country indicators supported by the World Bank API.

Usage

wb_country_indicator(
  indicator = "NY.GDP.MKTP.CD",
  country = NULL,
  lang = "en",
  start_date = NULL,
  end_date = NULL
)

Arguments

indicator

character(1) indicator to query.

country

character() country to query. Default NULL. If NULL, all countries are returned.

lang

character(1) language to query. Default "en".

start_date

character(1) or integer(1) start date to query. Default NULL. Supported formats:

  • YYYY for yearly data (e.g. 2020 or "2020")

  • YYYYQ[1-4] for quarterly data (e.g. "2020Q1")

  • YYYYM[1-12] for monthly data (e.g. "2020M02")

end_date

character(1) or integer(1) end date to query, in the same format as start_date. Default NULL.

Value

A data.frame() with the available country indicators. The columns are:

date

The date

indicator_id

The indicator ID.

indicator_name

The indicator name.

country_id

The country ID.

country_name

The country name.

country_code

The country code.

value

The indicator value.

unit

The indicator unit.

obs_status

The observation status.

decimal

The decimal.

Examples

wb_country_indicator("NY.GDP.MKTP.CD", "US")
#> # A tibble: 64 × 10
#>     date indicator_id   indicator_name    country_id country_name  country_code
#>    <int> <chr>          <chr>             <chr>      <chr>         <chr>       
#>  1  2023 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  2  2022 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  3  2021 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  4  2020 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  5  2019 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  6  2018 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  7  2017 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  8  2016 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#>  9  2015 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#> 10  2014 NY.GDP.MKTP.CD GDP (current US$) US         United States USA         
#> # ℹ 54 more rows
#> # ℹ 4 more variables: value <dbl>, unit <chr>, obs_status <chr>, decimal <int>
wb_country_indicator(
  "DPANUSSPB", c("CHN", "BRA"),
  start_date = "2012M01", end_date = "2012M08"
)
#> # A tibble: 16 × 10
#>    date   indicator_id indicator_name country_id country_name country_code value
#>    <chr>  <chr>        <chr>          <chr>      <chr>        <chr>        <dbl>
#>  1 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            2.03
#>  2 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            2.03
#>  3 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            2.05
#>  4 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            1.98
#>  5 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            1.85
#>  6 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            1.79
#>  7 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            1.72
#>  8 2012M… DPANUSSPB    Exchange rate… BRA        Brazil       NA            1.79
#>  9 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.36
#> 10 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.37
#> 11 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.36
#> 12 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.32
#> 13 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.30
#> 14 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.31
#> 15 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.30
#> 16 2012M… DPANUSSPB    Exchange rate… CHN        China        NA            6.31
#> # ℹ 3 more variables: unit <chr>, obs_status <chr>, decimal <int>