ids_get {wbids}R Documentation

Fetch Debt Statistics from the World Bank International Debt Statistics API

Description

This function returns a tibble with debt statistics data fetched from the World Bank International Debt Statistics (IDS) API. The data can be filtered by geographies, series, counterparts, and time periods.

Usage

ids_get(
  geographies,
  series,
  counterparts = "all",
  start_date = NULL,
  end_date = NULL,
  progress = FALSE
)

Arguments

geographies

A character vector representing the geographic codes (e.g., "ZMB" for Zambia). This argument is required and cannot contain NA values.

series

A character vector representing the series codes (e.g., "DT.DOD.DPPG.CD"). This argument is required and cannot contain NA values.

counterparts

A character vector representing counterpart areas (e.g., "all", "001"). This argument is required and cannot contain NA values (default: "all").

start_date

An optional numeric value representing the starting year (e.g., 2015). It must be greater than or equal to 1970. If not provided, the entire time range is used.

end_date

An optional numeric value representing the ending year (e.g., 2020). It must be greater than or equal to 1970 and cannot be earlier than start_date. If not provided, the entire available time range is used.

progress

A logical value indicating whether to display a progress message during the request process (default: FALSE). Must be either TRUE or FALSE.

Value

A tibble containing debt statistics with the following columns:

geography_id

The unique identifier for the geography (e.g., "ZMB").

series_id

The unique identifier for the series (e.g., "DT.DOD.DPPG.CD").

counterpart_id

The unique identifier for the counterpart (e.g., "all").

year

The year corresponding to the data (e.g., 2020).

value

The numeric value representing the statistic for the given geography, series, counterpart, and year.

Examples



# Fetch data for a series without specifying a time range or counterpart
ids_get(
  geographies = "ZMB",
  series = "DT.DOD.DPPG.CD",
)

# Fetch specific debt statistics for Zambia from 2015 to 2020
ids_get(
  geographies = "ZMB",
  series = c("DT.DOD.DPPG.CD", "BM.GSR.TOTL.CD"),
  start_date = 2015,
  end_date = 2020
)

# Fetch data for specific counterparts
ids_get(
  geographies = "ZMB",
  series = "DT.DOD.DPPG.CD",
  counterparts = c("216", "231")
)

# Fetch data for multiple geographies and counterparts
ids_get(
  geographies = c("ZMB", "CHN"),
  series = "DT.DOD.DPPG.CD",
  counterparts = c("216", "231"),
  start_date = 2019,
  end_date = 2020
)



[Package wbids version 0.1.0 Index]