% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/download.R
\name{download_wid}
\alias{download_wid}
\alias{download}
\title{Download data from WID.world}
\usage{
download_wid(
  indicators = "all",
  areas = "all",
  years = "all",
  perc = "all",
  ages = "992",
  pop = "j",
  metadata = FALSE,
  include_extrapolations = TRUE,
  verbose = FALSE,
  cache = TRUE
)

download(
  indicators = "all",
  areas = "all",
  years = "all",
  perc = "all",
  ages = "992",
  pop = "j",
  metadata = FALSE,
  include_extrapolations = TRUE,
  verbose = FALSE,
  cache = TRUE
)
}
\arguments{
\item{indicators}{WID variable codes or \code{"all"}.}

\item{areas}{ISO-2 area codes or \code{"all"}.}

\item{years}{Integer vector or \code{"all"}.}

\item{perc}{Percentile codes or \code{"all"}.}

\item{ages}{Age codes or \code{"all"}. Default \code{"992"}.}

\item{pop}{Population unit codes or \code{"all"}. Default \code{"j"}.}

\item{metadata}{Logical. If \code{TRUE}, fetches metadata as a
\code{"wid_meta"} attribute on the returned object. Default \code{FALSE}.}

\item{include_extrapolations}{Logical. Default \code{TRUE}.}

\item{verbose}{Logical. Default \code{FALSE}.}

\item{cache}{Logical. Default \code{TRUE}.}
}
\value{
A \code{wid_df} (a classed \code{data.frame}) with columns
\code{country}, \code{variable}, \code{percentile}, \code{year},
\code{value}, \code{age}, \code{pop}. If \code{metadata = TRUE},
a \code{"wid_meta"} attribute is attached.
}
\description{
Returns a \code{wid_df}, a classed \code{data.frame} that works natively
with dplyr, ggplot2, and all base-R operations.
}
\examples{
\donttest{
  if (nzchar(Sys.getenv("WID_API_KEY"))) {
    d <- download_wid(
      indicators = "sptinc992j",
      areas      = "US",
      perc       = "p99p100",
      years      = 2010:2020
    )
  }
}
}
