% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/indicators.R
\name{wb_data}
\alias{wb_data}
\alias{wb_country_indicator}
\title{World Bank country indicator data}
\source{
\url{https://api.worldbank.org/v2/country/{country}/indicator/{indicator}}
}
\usage{
wb_data(
  indicator = "NY.GDP.MKTP.CD",
  country = NULL,
  lang = "en",
  start_date = NULL,
  end_date = NULL,
  mrv = NULL,
  gapfill = FALSE,
  footnote = FALSE
)

wb_country_indicator(
  indicator = "NY.GDP.MKTP.CD",
  country = NULL,
  lang = "en",
  start_date = NULL,
  end_date = NULL,
  mrv = NULL,
  gapfill = FALSE,
  footnote = FALSE
)
}
\arguments{
\item{indicator}{(\code{character()})\cr
Indicators to query.}

\item{country}{(\code{NULL} | \code{character()})\cr
Countries to query. Default \code{NULL}. If \code{NULL}, all countries are returned.}

\item{lang}{(\code{character(1)})\cr
Language to query. Default \code{"en"}.}

\item{start_date}{(\code{NULL} | \code{character(1)} | \code{integer(1)})\cr
Start date to query. Default \code{NULL}. Supported formats:
\itemize{
\item YYYY for yearly data (e.g. \code{2020} or \code{"2020"})
\item YYYYQ[1-4] for quarterly data (e.g. \code{"2020Q1"})
\item YYYYM[1-12] for monthly data (e.g. \code{"2020M02"})
}}

\item{end_date}{(\code{NULL} | \code{character(1)} | \code{integer(1)})\cr
End date to query, in the same format as start_date. Default \code{NULL}.}

\item{mrv}{(\code{NULL} | \code{integer(1)})\cr
Most recent values to return. An alternative to \code{start_date}/\code{end_date}. Default \code{NULL}.}

\item{gapfill}{(\code{logical(1)})\cr
Whether to fill missing values by carrying forward the last available value. Only used when
\code{mrv} is set. Default \code{FALSE}.}

\item{footnote}{(\code{logical(1)})\cr
Whether to return the footnotes published alongside the observations, such as uncertainty
bounds or the survey a figure was derived from. Default \code{FALSE}.}
}
\value{
A \code{data.frame()} with the available country indicators.
The columns are:
\itemize{
\item \code{date}: The date. An integer if all observations are annual, otherwise a character vector.
\item \code{indicator_id}: The indicator ID.
\item \code{indicator_name}: The indicator name.
\item \code{country_id}: The country ID.
\item \code{country_name}: The country name.
\item \code{country_code}: The country code.
\item \code{value}: The indicator value.
\item \code{unit}: The indicator unit.
\item \code{obs_status}: The observation status.
\item \code{decimal}: The decimal.
\item \code{footnote}: The observation footnote, or \code{NA} if there is none. Only present when
\code{footnote = TRUE}.
}
}
\description{
List all country indicators supported by the World Bank API.
}
\examples{
\dontshow{if (httr2::is_online()) withAutoprint(\{ # examplesIf}
\donttest{
# single indicator for a single country (all available years)
ind <- wb_data("NY.GDP.MKTP.CD", "US")
head(ind)

# multiple indicators for multiple countries (2015-2023)
ind <- wb_data(
  indicator = c("NY.GDP.MKTP.CD", "FP.CPI.TOTL.ZG"),
  country = c("US", "DE", "FR", "CH", "JP"),
  start_date = 2015, end_date = 2023
)
head(ind)

# include the per-observation footnotes
ind <- wb_data("SI.POV.DDAY", "ALB", footnote = TRUE)
head(ind[c("date", "value", "footnote")])
}
\dontshow{\}) # examplesIf}
}
\seealso{
Other indicators data:
\code{\link[=wb_bulk]{wb_bulk()}},
\code{\link[=wb_country]{wb_country()}},
\code{\link[=wb_income_level]{wb_income_level()}},
\code{\link[=wb_indicator]{wb_indicator()}},
\code{\link[=wb_language]{wb_language()}},
\code{\link[=wb_lending_type]{wb_lending_type()}},
\code{\link[=wb_region]{wb_region()}},
\code{\link[=wb_search]{wb_search()}},
\code{\link[=wb_source]{wb_source()}},
\code{\link[=wb_topic]{wb_topic()}}
}
\concept{indicators data}
