Get poverty and inequality statistics

get_stats(
  country = "all",
  year = "all",
  povline = NULL,
  popshare = NULL,
  fill_gaps = FALSE,
  nowcast = FALSE,
  subgroup = NULL,
  welfare_type = c("all", "income", "consumption"),
  reporting_level = c("all", "national", "urban", "rural"),
  version = NULL,
  ppp_version = NULL,
  release_version = NULL,
  api_version = "v1",
  format = c("arrow", "rds", "json", "csv"),
  simplify = TRUE,
  server = NULL
)

get_wb(
  year = "all",
  povline = NULL,
  version = NULL,
  ppp_version = NULL,
  release_version = NULL,
  api_version = "v1",
  format = c("rds", "json", "csv"),
  simplify = TRUE,
  server = NULL
)

get_agg(
  year = "all",
  povline = NULL,
  version = NULL,
  ppp_version = NULL,
  release_version = NULL,
  aggregate = NULL,
  api_version = "v1",
  format = c("rds", "json", "csv"),
  simplify = TRUE,
  server = NULL
)

Arguments

country

Uppercase, three-letter country ISO codes or "all".

year

Integer-valued numeric years, "all", or "MRV" (most recent value). Character strings containing years are not accepted.

povline

One finite, non-negative numeric poverty line, or NULL. Ignored when popshare is supplied.

popshare

One numeric population share from 0 to 1, or NULL.

fill_gaps

One non-missing logical value. If TRUE, interpolate or extrapolate missing years. Also enabled by nowcast = TRUE.

nowcast

One non-missing logical value. If TRUE, return nowcast estimates and enable fill_gaps.

subgroup

NULL, "wb_regions", or "none". A non-NULL value uses the grouped endpoint and disables gap filling and nowcasting.

welfare_type

character: Welfare type either of c("all", "income", "consumption")

reporting_level

character: Geographical reporting level either of c("all", "national", "urban", "rural")

version

Data version in YYYYMMDD_PPP_XX_YY_IDENTITY format, or NULL. See get_versions().

ppp_version

One integer-valued numeric PPP year, a four-digit year string, or NULL.

release_version

A valid publication date in YYYYMMDD format, or NULL.

api_version

API version. Currently only "v1" is supported.

format

Response format: "arrow", "rds", "json", or "csv" for get_stats(). get_wb() and get_agg() accept "rds", "json", or "csv".

simplify

One non-missing logical value. If TRUE (the default), return simplified data.

server

One non-empty server name, or NULL for the production server. For World Bank internal use only.

aggregate

Aggregate name. See get_aux("country_list") for available options.

Value

A tibble of statistics when simplify = TRUE, or a pip_api list when simplify = FALSE.

Examples

if (interactive()) {
# One country-year
res <- get_stats(country = "AGO", year = 2000)

# All years for a specific country
res <- get_stats(country = "AGO", year = "all")

# All countries and years
res <- get_stats(country = "all", year = "all")

# All countries and years w/ alternative poverty line
res <- get_stats(country = "all", year = "all", povline = 3.2)

# Fill gaps for years without available survey data
res <- get_stats(country = "all", year = "all", fill_gaps = TRUE)

# Proportion living below the poverty line
res <- get_stats(country = "all", year = "all", popshare = .4)

# World Bank global and regional aggregates
res <- get_stats("all", year = "all", subgroup = "wb_regions")

# Short hand to get WB global/regional stats
res <- get_wb()

# Short hand to get fcv stats
res <- get_agg(aggregate = "fcv")

# Custom aggregates
res <- get_stats(c("ARG", "BRA"), year = "all", subgroup = "none")
}