Fetches only the SpatialDim and TimeDim columns for a GHO
indicator (much lighter than gho_data()) and summarises the
year range and observation count per location. Useful for
answering "which countries have data, and for what years?"
before committing to a full download.
Usage
gho_coverage(
indicator,
spatial_type = "country",
area = NULL,
year_from = NULL,
year_to = NULL,
dim1 = NULL,
dim2 = NULL,
dim3 = NULL,
dimensions = NULL,
backend = NULL
)Arguments
- indicator
Character scalar. The indicator code (e.g.
"WHOSIS_000001").- spatial_type
Character. Spatial dimension to filter on: one of
"country","region","global". Defaults to"country"since per-country coverage is the typical use case. PassNULLfor all spatial levels.- area
Character vector of country or region codes (e.g.
c("FRA", "DEU")). DefaultNULLreturns all areas for the chosenspatial_type.- year_from
Numeric. Start year filter (inclusive). Default
NULL.- year_to
Numeric. End year filter (inclusive). Default
NULL.- dim1, dim2, dim3
Character vector of values to keep for the
Dim1/Dim2/Dim3breakdown columns, filtered server-side (e.g.dim1 = "SEX_BTSX"for both-sexes rows only, ordim1 = c("SEX_MLE", "SEX_FMLE")). The meaning of each dimension varies by indicator (Dim1is sex for one indicator, an age group for another); usegho_dimensions()to discover the values available for a given indicator. Rows where the dimension is empty (null) are excluded by the filter. DefaultNULL(no filtering). On xMart wide tables, positions follow named dimensions in the source table schema (sex, age, then alphabetical). These positions can differ from the legacy API. Preferdimensions. Canonical sex codes and theAGEGROUP_namespace remain supported in positional filters. Named filters use the provider's exact native codes.- dimensions
Optional named list of exact xMart dimension fields and values, e.g.
list(DIM_SEX = 'TOTAL'). Requires xMart; automatic selection never translates these filters to legacy.- backend
Character scalar.
"auto","xmart"or"legacy". DefaultNULLuses theDSIR.who_backendoption, or"auto"when that option is unset. An explicit argument overrides the option for this call without changing it. Use the same backend for discovery and retrieval.
Value
A tibble with one row per location and columns:
location(chr) — theSpatialDimvalue (typically ISO3).year_min(int) — earliest year with data.year_max(int) — latest year with data.-
n_obs(int) — number of observations.Sorted by
location. Empty input or service failure returns an empty tibble with the same four columns.
Examples
# \donttest{
# Year coverage of life expectancy for three countries
gho_coverage("WHOSIS_000001", area = c("FRA", "DEU", "JPN"))
# All countries with any life-expectancy data, since 2010
gho_coverage("WHOSIS_000001", year_from = 2010)
# }