This function retrieves information about entities (countries and regions) from the World Bank API. It returns a tibble containing various details such as the entity's ID, ISO2 code, name, region information, lending type, capital city, and coordinates.
wdi_get_entities(language = "en", per_page = 1000)A tibble with the following columns:
A character string representing the entity's unique identifier.
A character string for the name of the entity.
A character string for the ISO2 country code.
A character string for the type of the entity ("country" or "region").
A character string representing the region's unique identifier.
A character string for the name of the region.
A character string for the ISO2 region code.
A character string representing the administrative region's unique identifier.
A character string for the name of the administrative region.
A character string for the ISO2 code of the administrative region.
A character string representing the entity's income level.
A character string for the name of the income level.
A character string for the ISO2 code of the income level.
A character string representing the lending type's unique identifier.
A character string for the name of the lending type.
A character string for the ISO2 code of the lending type.
A character string for the name of the capital city.
A numeric value for the longitude of the entity.
A numeric value for the latitude of the entity.
A character string specifying the language for the API
response. Defaults to "en" (English). Other supported options include
"es" (Spanish), "fr" (French), and others depending on the API.
An integer specifying the number of records to fetch per
request. Defaults to 1000.
This function sends a request to the World Bank API to retrieve data for all supported entities in the specified language. The data is then processed into a tidy format and includes information about the country, such as its ISO code, capital city, geographical coordinates, and additional metadata about regions, income levels, and lending types.
# Download all entities in English
wdi_get_entities()
# Download all entities in Spanish
wdi_get_entities(language = "zh")
Run the code above in your browser using DataLab