wb_country_indicator: World Bank country indicator data

View source: R/indicators.R

wb_country_indicatorR Documentation

World Bank country indicator data

Description

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()) indicators to query.

country

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

lang

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

start_date

(character(1) | 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) | 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.

Source

https://api.worldbank.org/v2/country/{country}/indicator/{indicator}

Examples

ind <- wb_country_indicator("NY.GDP.MKTP.CD", "US")
head(ind)
ind <- wb_country_indicator(
  indicator = c("NY.GDP.MKTP.CD", "FP.CPI.TOTL.ZG"),
  country = c("US", "DE", "FR", "CH", "JP"),
  start_date = 2015, end_date = 2023
)
head(ind)

worldbank documentation built on April 4, 2025, 1:35 a.m.