% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gho.R
\name{gho_coverage}
\alias{gho_coverage}
\title{Summarise Per-Location Data Coverage of a GHO Indicator}
\usage{
gho_coverage(
  indicator,
  spatial_type = "country",
  area = NULL,
  year_from = NULL,
  year_to = NULL,
  dim1 = NULL,
  dim2 = NULL,
  dim3 = NULL
)
}
\arguments{
\item{indicator}{Character scalar. The indicator code
(e.g. \code{"WHOSIS_000001"}).}

\item{spatial_type}{Character. Spatial dimension to filter on:
one of \code{"country"}, \code{"region"}, \code{"global"}. Defaults to
\code{"country"} since per-country coverage is the typical use
case. Pass \code{NULL} for all spatial levels.}

\item{area}{Character vector of country or region codes
(e.g. \code{c("FRA", "DEU")}). Default \code{NULL} returns all areas
for the chosen \code{spatial_type}.}

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

\item{year_to}{Numeric. End year filter (inclusive).
Default \code{NULL}.}

\item{dim1, dim2, dim3}{Character vector of values to keep for the
\code{Dim1} / \code{Dim2} / \code{Dim3} breakdown columns, filtered server-side
(e.g. \code{dim1 = "SEX_BTSX"} for both-sexes rows only, or
\code{dim1 = c("SEX_MLE", "SEX_FMLE")}). The meaning of each dimension
varies by indicator (\code{Dim1} is sex for one indicator, an age
group for another); use \code{\link[=gho_dimensions]{gho_dimensions()}} to discover the values
available for a given indicator. Rows where the dimension is
empty (\code{null}) are excluded by the filter. Default \code{NULL} (no
filtering).}
}
\value{
A \link[tibble:tibble]{tibble} with one row per location and
columns:
\itemize{
\item \code{location} (chr) — the \code{SpatialDim} value (typically ISO3).
\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}. Empty input or service failure returns
an empty tibble with the same four columns.
}
}
\description{
Fetches only the \code{SpatialDim} and \code{TimeDim} columns for a GHO
indicator (much lighter than \code{\link[=gho_data]{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.
}
\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)
}
}
\seealso{
\code{\link[=gho_data]{gho_data()}}, \code{\link[=gho_has_data]{gho_has_data()}}, \code{\link[=gho_count]{gho_count()}}.
}
