Skip to contents

A single SDG indicator (for example "3.4.1", NCD mortality) is typically published as several series stratified by sex, age, or cause. Different series may have different country and year coverage. sdg_coverage() summarises year range and observation count per (location, series) combination, so you can see which series exist for an indicator and how each one is covered before committing to a downstream analysis.

Usage

sdg_coverage(
  indicator,
  area = NULL,
  year_from = NULL,
  year_to = NULL,
  series = NULL,
  dimensions = NULL
)

Arguments

indicator

Character vector of SDG indicator codes (e.g. "3.4.1").

area

Character vector of country/area codes. Accepts either ISO3 codes (e.g. c("PHL", "FRA")) — converted automatically via iso3_to_m49() — or UN M49 numeric codes (e.g. c("608", "250")) as returned by sdg_areas(). Do not mix the two formats in a single call. Default NULL returns all areas. Unknown ISO3 codes are dropped with a warning before the network call.

year_from

Numeric. Start year filter (inclusive). Default NULL.

year_to

Numeric. End year filter (inclusive). Default NULL.

series, dimensions

Optional series codes and named dimension filters, passed to sdg_data(). Coverage is calculated after filtering. Without these filters, n_obs counts all strata together, not distinct years or a single population group.

Value

A tibble with one row per (location, series) and columns:

  • location (chr) — area code (geoAreaCode).

  • series (chr) — SDG series code.

  • year_min (int) — earliest year with data.

  • year_max (int) — latest year with data.

  • n_obs (int) — number of observations.

    Sorted by location then series. Empty input or service failure returns an empty tibble with the same five columns. Request, parsing, and incomplete-download warnings from sdg_data() are retained.

Details

Unlike the GHO availability helpers, this function is a series-exploration tool rather than a payload-saving precheck: SDG data is generally complete enough that GHO-style has_data() / count() helpers add little value, so they are intentionally not provided. The SDG API also offers no payload-reduction option (no $select equivalent), so sdg_coverage() calls sdg_data() internally and aggregates the result client-side.

Examples

# \donttest{
# Series available for NCD mortality in China and Brazil
sdg_coverage("3.4.1", area = c("156", "076"))

# Filter to a year range
sdg_coverage("3.4.1", area = "156", year_from = 2015)
# }