Title: | Seamless Access to World Bank International Debt Statistics (IDS) |
---|---|
Description: | Access and analyze the World Bank's International Debt Statistics (IDS) <https://datacatalog.worldbank.org/search/dataset/0038015>. IDS provides creditor-debtor relationships between countries, regions, and institutions. 'wbids' enables users to download, process and work with IDS series across multiple geographies, counterparts, and time periods. |
Authors: | Teal Emery [aut, cre],
Teal Insights [cph],
Christoph Scheuch [aut] |
Maintainer: | Teal Emery <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0.9000 |
Built: | 2025-03-07 21:28:54 UTC |
Source: | https://github.com/teal-insights/r-wbids |
This function downloads a data file from the World Bank International Debt Statistics (IDS), reads and processes the data into a tidy format.
ids_bulk( file_url, file_path = tempfile(fileext = ".xlsx"), quiet = FALSE, timeout = getOption("timeout", 60), warn_size = TRUE )
ids_bulk( file_url, file_path = tempfile(fileext = ".xlsx"), quiet = FALSE, timeout = getOption("timeout", 60), warn_size = TRUE )
file_url |
A character string specifying the URL of the Excel file to download. This parameter is required (see ids_bulk_files). |
file_path |
An optional character string specifying the file path where
the downloaded file will be saved. Defaults to a temporary file with |
quiet |
A logical parameter indicating whether messages should be printed to the console. |
timeout |
An integer specifying the timeout in seconds for downloading the file. Defaults to the current R timeout setting. |
warn_size |
A logical parameter indicating whether to warn about large downloads. Defaults to TRUE. |
A tibble containing processed debt statistics data with the following columns:
The unique identifier for the geography (e.g., "ZMB").
The unique identifier for the series (e.g., "DT.DOD.DPPG.CD").
The unique identifier for the counterpart series.
The year corresponding to the data (as an integer).
The numeric value representing the statistic for the given geography, series, counterpart, and year.
## Not run: available_files <- ids_bulk_files() data <- ids_bulk( available_files$file_url[1] ) ## End(Not run)
## Not run: available_files <- ids_bulk_files() data <- ids_bulk( available_files$file_url[1] ) ## End(Not run)
This function returns a tibble with metadata for files available for bulk download via the World Bank International Debt Statistics (IDS). It includes information such as file names, URLs, and the last update dates for each file in Excel (xlsx) format.
ids_bulk_files()
ids_bulk_files()
A tibble containing the available files and their metadata:
The name of the file available for download.
The URL to download the file in Excel format.
The date when the file was last updated.
ids_bulk_files()
ids_bulk_files()
This function retrieves a tibble with metadata for series available via bulk download of the World Bank International Debt Statistics (IDS).
ids_bulk_series()
ids_bulk_series()
A tibble containing the available series and their metadata:
The unique identifier for the series (e.g., "BN.CAB.XOKA.CD").
The name of the series (e.g., "Current account balance (current US$)").
The ID of the data source providing the indicator.
The name or description of the source of the indicator data.
Additional notes or descriptions about the data source.
The organization responsible for the data source.
ids_bulk_series()
ids_bulk_series()
Retrieves standardized debt statistics from the World Bank's International Debt Statistics (IDS) database, which provides comprehensive data on the external debt of low and middle-income countries. The function handles country identification, data validation, and unit standardization, making it easier to conduct cross-country debt analysis and monitoring.
ids_get( geographies, series, counterparts = "WLD", start_year = 2000, end_year = NULL, progress = FALSE )
ids_get( geographies, series, counterparts = "WLD", start_year = 2000, end_year = NULL, progress = FALSE )
geographies |
A character vector of geography identifiers representing
debtor countries and aggregates. Must use
|
series |
A character vector of debt statistics series identifiers that
must match the |
counterparts |
A character vector of creditor identifiers that must
match the
|
start_year |
A numeric value representing the starting year (default: 2000). This default is intended to reduce data volume. For historical analysis, explicitly set to 1970 (the earliest year of data available). |
end_year |
A numeric value representing the ending year (default: NULL). Must be >= 1970 and cannot be earlier than start_year. If NULL, returns data through the most recent available year. Some debt service-related series include projections of debt service. For the 2024 data release, debt service projections are available through 2031. |
progress |
A logical value indicating whether to display progress messages during data retrieval (default: FALSE). |
A tibble containing debt statistics with the following columns:
The identifier for the debtor geography (e.g., "GHA" for Ghana, "LIC" for low income countries)
The identifier for the debt statistic series (e.g., "DT.DOD.DECT.CD" for total external debt stocks)
The identifier for the creditor (e.g., "WLD" for world total, "730" for China)
The year of the observation
The numeric value of the debt statistic, standardized to the units specified in the series definition (typically current US dollars)
The IDS database provides detailed debt statistics for low and middle-income countries, including:
Debt stocks and flows
Debt service and interest payments
Creditor composition
Terms and conditions of new commitments
To ensure valid queries:
Use ids_list_geographies to find valid debtor geography codes
Use ids_list_series to explore available debt statistics
Use ids_list_counterparts to see available creditor codes
ids_list_geographies()
for available debtor geography codes
ids_list_series()
for available debt statistics series codes
ids_list_counterparts()
for available creditor codes
# Get total external debt stocks for a single country from 2000 onward ghana_debt <- ids_get( geographies = "GHA", series = "DT.DOD.DECT.CD" # External debt stocks, total ) # Compare debt service metrics across income groups income_groups <- ids_get( geographies = c("LIC", "LMC", "UMC"), # Income group aggregates series = "DT.TDS.DECT.CD", # Total debt service start_year = 2010 ) # Analyze debt composition by major creditors creditor_analysis <- ids_get( geographies = c("KEN", "ETH"), # Kenya and Ethiopia series = c( "DT.DOD.DECT.CD", # Total external debt "DT.TDS.DECT.CD" # Total debt service ), counterparts = c( "WLD", # World total "730", # China "907", # IMF "BND" # Bondholders ), start_year = 2015 )
# Get total external debt stocks for a single country from 2000 onward ghana_debt <- ids_get( geographies = "GHA", series = "DT.DOD.DECT.CD" # External debt stocks, total ) # Compare debt service metrics across income groups income_groups <- ids_get( geographies = c("LIC", "LMC", "UMC"), # Income group aggregates series = "DT.TDS.DECT.CD", # Total debt service start_year = 2010 ) # Analyze debt composition by major creditors creditor_analysis <- ids_get( geographies = c("KEN", "ETH"), # Kenya and Ethiopia series = c( "DT.DOD.DECT.CD", # Total external debt "DT.TDS.DECT.CD" # Total debt service ), counterparts = c( "WLD", # World total "730", # China "907", # IMF "BND" # Bondholders ), start_year = 2015 )
This function returns a tibble with available counterparts from the World Bank International Debt Statistics (IDS) API. Each row provides details on counterparts, including their unique identifiers, names, and types.
ids_list_counterparts()
ids_list_counterparts()
A tibble containing the available counterparts and their attributes:
The unique identifier for the counterpart (e.g., "730").
The standardized name of the counterpart (e.g., "China").
ISO 3166-1 alpha-2 code of the counterpart (e.g., "CN").
ISO 3166-1 alpha-3 code of the counterpart (e.g., "CHN").
The type of counterpart (e.g., "Country", "Institution", "Region").
ids_list_counterparts()
ids_list_counterparts()
This function returns a tibble with available geographies from the World Bank International Debt Statistics (IDS) API. Each row provides details on geographies, including their unique identifiers, names, and types.
ids_list_geographies()
ids_list_geographies()
A tibble containing the available geographies and their attributes:
ISO 3166-1 alpha-3 code of the geography (e.g., "ZMB").
The standardized name of the geography (e.g., "Zambia").
ISO 3166-1 alpha-2 code of the geography (e.g., "ZM").
The type of geography (e.g., "Country", "Region").
The capital city of the geography (e.g., "Lusaka").
The unique identifier for the region (e.g., "SSF").
ISO 3166-1 alpha-2 code of the region (e.g., "ZG").
The name of the region (e.g., "Sub-Saharan Africa").
The unique identifier for the administrative region (e.g., "SSA").
The ISO 3166-1 alpha-2 code for the administrative region (e.g., "ZF").
The name of the administrative region (e.g., "Sub-Saharan Africa (excluding high income)").
The unique identifier for the lending type (e.g., "IDX").
ISO code for the lending type (e.g., "XI").
The name of the lending type (e.g., "IDA").
ids_list_geographies()
ids_list_geographies()
This function returns a tibble with available series from the World Bank International Debt Statistics (IDS) API. Each series provides data on various debt-related indicators.
ids_list_series()
ids_list_series()
A tibble containing the available series and their metadata:
The unique identifier for the series (e.g., "BN.CAB.XOKA.CD").
The name of the series (e.g., "Current account balance (current US$)").
The ID of the data source providing the indicator.
The name or description of the source of the indicator data.
Additional notes or descriptions about the data source.
The organization responsible for the data source.
ids_list_series()
ids_list_series()
This function returns a tibble with available series-topic combinations from the World BankInternational Debt Statistics (IDS) API. Each row provides a mapping from series to topic, with the possibility of multiple topic per series.
ids_list_series_topics()
ids_list_series_topics()
A tibble containing the available series and their topics:
The unique identifier for the series (e.g., "BM.GSR.TOTL.CD").
The unique identifier for the topic (e.g., 3).
The name of the topic (e.g., "External Debt").
ids_list_series_topics()
ids_list_series_topics()