% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iso3_to_m49.R
\name{iso3_to_m49}
\alias{iso3_to_m49}
\title{Convert ISO3 Codes to UN M49 Numeric Codes}
\usage{
iso3_to_m49(iso3)
}
\arguments{
\item{iso3}{Character vector of ISO3 codes. Case-insensitive;
values are upper-cased before lookup.}
}
\value{
A character vector the same length as \code{iso3}, with M49
codes in the same format as \code{who_countries$m49_code} (three-
character zero-padded strings, e.g. \code{"076"}). Non-Member areas
return \code{NA}.
}
\description{
Maps ISO 3166-1 alpha-3 country codes to UN M49 numeric area codes
using the \code{\link{who_countries}} dataset shipped with DSIR. Useful when
moving from data sources keyed by ISO3 (e.g. the WHO GHO API) to
sources keyed by M49 (e.g. the UN SDG API).
}
\details{
Codes that do not correspond to a WHO Member State return \code{NA}.
This includes Associate Members (e.g. Puerto Rico) and other
non-Member areas that some indicator data sets cover.

Most users will not need to call this function directly:
\code{\link[=sdg_data]{sdg_data()}} and \code{\link[=sdg_coverage]{sdg_coverage()}} accept ISO3 codes for their
\code{area} argument and convert internally. This helper is exported
for cases where you want to inspect or manipulate the conversion
yourself.
}
\examples{
iso3_to_m49(c("PHL", "FRA", "JPN"))
# "608" "250" "392"

# Case-insensitive
iso3_to_m49("phl")
# "608"

# Non-Member areas return NA
iso3_to_m49(c("PRI", "PHL"))
# NA "608"
}
\seealso{
\code{\link{who_countries}}, \code{\link[=iso3_to_region]{iso3_to_region()}}, \code{\link[=sdg_data]{sdg_data()}}.
}
