% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sdg_coverage.R
\name{sdg_coverage}
\alias{sdg_coverage}
\title{Explore Series Coverage of an SDG Indicator}
\usage{
sdg_coverage(indicator, area = NULL, year_from = NULL, year_to = NULL)
}
\arguments{
\item{indicator}{Character vector of SDG indicator codes
(e.g. \code{"3.4.1"}).}

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

\item{year_from}{Numeric. Start year filter (inclusive).
Default \code{NULL}.}

\item{year_to}{Numeric. End year filter (inclusive).
Default \code{NULL}.}
}
\value{
A \link[tibble:tibble]{tibble} with one row per
\verb{(location, series)} and columns:
\itemize{
\item \code{location} (chr) — area code (\code{geoAreaCode}).
\item \code{series} (chr) — SDG series code.
\item \code{year_min} (int) — earliest year with data.
\item \code{year_max} (int) — latest year with data.
\item \code{n_obs} (int) — number of observations.

Sorted by \code{location} then \code{series}. Empty input or service
failure returns an empty tibble with the same five columns.
}
}
\description{
A single SDG indicator (for example \code{"3.4.1"}, NCD mortality) is
typically published as several \strong{series} stratified by sex, age,
or cause. Different series may have different country and year
coverage. \code{sdg_coverage()} summarises year range and observation
count per \verb{(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.
}
\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
\code{has_data()} / \code{count()} helpers add little value, so they are
intentionally not provided. The SDG API also offers no
payload-reduction option (no \verb{$select} equivalent), so
\code{sdg_coverage()} calls \code{\link[=sdg_data]{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)
}
}
\seealso{
\code{\link[=sdg_data]{sdg_data()}}, \code{\link[=sdg_indicators]{sdg_indicators()}}, \code{\link[=gho_coverage]{gho_coverage()}}.
}
