% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gho.R
\name{gho_count}
\alias{gho_count}
\title{Count Observations for a GHO Indicator Filter}
\usage{
gho_count(
  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{
An integer scalar — the number of observations the
server would return for the same filter via \code{\link[=gho_data]{gho_data()}}.
Returns \code{NA_integer_} (with a warning) if the request fails.
}
\description{
Sends a \verb{$top=0&$count=true} request to the WHO GHO OData API,
which returns the matching row count without transferring any
observations. Useful for sizing a download before issuing it.
}
\examples{
\donttest{
# How many rows would gho_data() pull for France?
gho_count("WHOSIS_000001", area = "FRA")

# Compare coverage across regions
gho_count("NCDMORT3070", spatial_type = "country")
gho_count("NCDMORT3070", spatial_type = "region")
}
}
\seealso{
\code{\link[=gho_data]{gho_data()}}, \code{\link[=gho_has_data]{gho_has_data()}}, \code{\link[=gho_coverage]{gho_coverage()}}.
}
