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.
wb_country_coverage(pattern, country, start_date, end_date, cache)A data.table with one row per country.
A character string or regular expression (e.g., "GDP").
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"
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.
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".
List of data frames returned from wb_cache(). If omitted, wb_cachelist is used
if (FALSE) {
wb_country_coverage("gross domestic product", c("Mexico", "Chile"), 2010, 2020)
}
Run the code above in your browser using DataLab