wb_country_coverage: Summarize Data Coverage for World Bank Indicators

View source: R/wb_country_coverage.R

wb_country_coverageR Documentation

Summarize Data Coverage for World Bank Indicators

Description

Given a indicator available from the World Bank API, this functions returns a pre-computed summary stored on GitHub and not available from the API that shows the percentage of non-missing (non-NA) observations for every country, the year range per country, and the total number of observations per country. This is useful before downloading a dataset.

Usage

wb_country_coverage(pattern, country, start_date, end_date, cache)

Arguments

pattern

A character string or regular expression (e.g., "GDP").

country

Character vector of country, region, or special value codes for the locations you want to return data for. Permissible values can be found in the countries data frame in wb_cachelist or by running wb_countries() directly. Specifically, values listed in the following fields iso3c, iso2c, country, region, admin_region, income_level and all of the region_*, admin_region_*, income_level_*, columns. As well as the following special values

  • "countries_only" (Default)

  • "regions_only"

  • "admin_regions_only"

  • "income_levels_only"

  • "aggregates_only"

  • "all"

start_date

Numeric or character. If numeric it must be in %Y form (i.e. four digit year). For data at the subannual granularity the API supports a format as follows: for monthly data, "2016M01" and for quarterly data, "2016Q1". This also accepts a special value of "YTD", useful for more frequently updated subannual indicators.

end_date

Numeric or character. If numeric it must be in %Y form (i.e. four digit year). For data at the subannual granularity the API supports a format as follows: for monthly data, "2016M01" and for quarterly data, "2016Q1".

cache

List of data frames returned from wb_cache(). If omitted, wb_cachelist is used

Value

A data.table with one row per country.

Examples

## Not run: 
wb_country_coverage("gross domestic product", c("Mexico", "Chile"), 2010, 2020)

## End(Not run)

wbstats documentation built on Aug. 28, 2026, 5:08 p.m.