NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")
  collapse = TRUE,
  comment = "#>",
  purl = NOT_CRAN

The povcalnetR package allows to easily query the PovcalNet API from R.

Here are a few examples to get you started:

Using default options

By default, the povcalnet function return all available


Basic options

Filter by country

# Specify ONE country
povcalnet(country = "ALB")

# Specify MULTIPLE countries
povcalnet(country = c("ALB", "CHN"))

Filter by year

By default, povcalnet will only return data if a survey is available for the requested country and the requested year

# Survey year NOT available
povcalnet(country = "ALB", year = 2012)

# Survey year NOT available - Empty response
povcalnet(country = "ALB", year = 2018)

Modify the poverty line

povcalnet(country = "ALB", povline = 3.2)

Other features

Get estimates when survey year is not available

The fill_gaps argument will trigger the interpolation / extrapolation of poverty estimates when survey year is not available

# fill_gaps = FALSE (default)
povcalnet(country = "HTI")

# fill_gaps = TRUE
povcalnet(country = "HTI", fill_gaps = TRUE)

Compute custom aggregates

The povcalnet function can also be used to compute aggregate welfare statistics of custom group of countries

# World aggregate
povcalnet(country = "all", aggregate = TRUE)

# Custom aggregate
povcalnet(country = c("CHL", "ARG", "BOL"), aggregate = TRUE)

Try the povcalnetR package in your browser

Any scripts or data that you put into this service are public.

povcalnetR documentation built on July 8, 2020, 6:48 p.m.