Get poverty and inequality statistics

get_stats(
  country = "all",
  year = "all",
  povline = NULL,
  popshare = NULL,
  fill_gaps = 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("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
)

Arguments

country

character: A vector with one or more country ISO 3 codes or 'all'

year

integer: A vector with one or more years or 'all'

povline

numeric: Poverty line

popshare

numeric: Proportion of the population living below the poverty line

fill_gaps

logical: If TRUE, will interpolate / extrapolate values for missing years

subgroup

character: If used result will be aggregated for predefined sub-groups. Either 'wb_regions' or 'none'.

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

character: Data version. See get_versions()

ppp_version

ppp year to be used

release_version

date when the data was published in YYYYMMDD format

api_version

character: API version

format

character: Response format either of c("rds", "json", "csv")

simplify

logical: If TRUE (the default) the response is returned as a tibble

server

character: Server. For WB internal use only

Value

If simplify = FALSE, it returns a list of class "pip_api". If simplify = TRUE, it returns a tibble with the requested data. This is the default. Only for get_aux(), If assign_tb = TRUE or character, it returns TRUE when data was assign properly to .pip env. FALSE, if it was not assigned.

Examples

if (FALSE) {
# 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")

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

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