% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gho.R
\name{gho_has_data}
\alias{gho_has_data}
\title{Check Whether a GHO Indicator Has Data for a Filter}
\usage{
gho_has_data(
  indicator,
  spatial_type = NULL,
  area = NULL,
  year_from = NULL,
  year_to = NULL
)
}
\arguments{
\item{indicator}{Character scalar. The indicator code
(e.g. \code{"NCDMORT3070"}). Use \code{\link[=gho_indicators]{gho_indicators()}} to find codes.}

\item{spatial_type}{Character. Spatial dimension to filter on:
one of \code{"country"}, \code{"region"}, \code{"global"}, or \code{NULL} (all
levels, the default).}

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

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

\item{year_to}{Numeric. End year filter (inclusive).
Default \code{NULL}.}
}
\value{
A logical scalar:
\itemize{
\item \code{TRUE} if at least one observation exists for the filter.
\item \code{FALSE} if the server returns an empty result.
\item \code{NA} if the request fails (network failure, unreachable host,
or the indicator code does not exist and the server returns an
HTTP error). A warning is emitted in the failure case.
}
}
\description{
Sends a minimal request (\verb{$top=1&$select=Id}) to the WHO GHO OData
API to find out whether any observations exist for the given
indicator and filter combination, without downloading the full
result set. Useful as a quick precheck before \code{\link[=gho_data]{gho_data()}}.
}
\examples{
\donttest{
# Does WHO have life-expectancy data for France?
gho_has_data("WHOSIS_000001", area = "FRA")

# Quickly screen a list of indicators before downloading any data
inds <- c("WHOSIS_000001", "NCDMORT3070")
vapply(inds, gho_has_data, logical(1), area = "FRA")
}
}
\seealso{
\code{\link[=gho_data]{gho_data()}}, \code{\link[=gho_count]{gho_count()}}, \code{\link[=gho_coverage]{gho_coverage()}}.
}
