% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sdg.R
\name{sdg_data}
\alias{sdg_data}
\title{Fetch SDG Data}
\usage{
sdg_data(
  indicator,
  area = NULL,
  year_from = NULL,
  year_to = NULL,
  page_size = 1000L
)
}
\arguments{
\item{indicator}{Character vector of indicator codes
(e.g. \code{"1.1.1"}). Use \code{\link[=sdg_indicators]{sdg_indicators()}} to find codes.}

\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.}

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

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

\item{page_size}{Integer. Number of records per page.
Default \code{1000}, maximum \code{10000}.}
}
\value{
A \link[tibble:tibble]{tibble} of indicator observations, or
an empty tibble when the service is unreachable or there are no
matching rows.
}
\description{
Retrieves data for one or more SDG indicators from the UN SDG
API, with optional filters by area and year.
}
\examples{
\donttest{
# One indicator, one country — the typical entry point
sdg_data("1.1.1", area = "PHL")

# Specific area and year range (M49 code)
sdg_data("3.2.1", area = "156", year_from = 2015, year_to = 2023)

# ISO3 codes work directly — DSIR's regional vectors can be passed in
sdg_data("3.4.1", area = c("PHL", "FRA", "JPN"))
}
}
\seealso{
\code{\link[=sdg_indicators]{sdg_indicators()}}, \code{\link[=sdg_areas]{sdg_areas()}}, \code{\link[=iso3_to_m49]{iso3_to_m49()}}.
}
