wdi_get_entities {wbwdi}R Documentation

Download all countries and regions from the World Bank API

Description

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.

Usage

wdi_get_entities(language = "en", per_page = 1000)

Arguments

language

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.

per_page

An integer specifying the number of records to fetch per request. Defaults to 1000.

Details

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.

Value

A tibble with the following columns:

entity_id

A character string representing the entity's unique identifier.

entity_name

A character string for the name of the entity.

entity_iso2code

A character string for the ISO2 country code.

entity_type

A character string for the type of the entity ("country" or "region").

region_id

A character string representing the region's unique identifier.

region_name

A character string for the name of the region.

region_iso2code

A character string for the ISO2 region code.

admin_region_id

A character string representing the administrative region's unique identifier.

admin_region_name

A character string for the name of the administrative region.

admin_region_iso2code

A character string for the ISO2 code of the administrative region.

income_level_id

A character string representing the entity's income level.

income_level_name

A character string for the name of the income level.

income_level_iso2code

A character string for the ISO2 code of the income level.

lending_type_id

A character string representing the lending type's unique identifier.

lending_type_name

A character string for the name of the lending type.

lending_type_iso2code

A character string for the ISO2 code of the lending type.

capital_city

A character string for the name of the capital city.

longitude

A numeric value for the longitude of the entity.

latitude

A numeric value for the latitude of the entity.

Examples


# Download all entities in English
wdi_get_entities()

# Download all entities in Spanish
wdi_get_entities(language = "zh")


[Package wbwdi version 1.0.1 Index]