Package {worldbank}


Title: Client for the 'World Bank' APIs
Version: 0.11.0
Description: Download and search data from the 'World Bank' APIs, including the 'Indicators' API, the 'Poverty and Inequality Platform (PIP)' API, the 'Finances One' API, the 'Projects' API, and the 'Documents & Reports' API. See https://datahelpdesk.worldbank.org/knowledgebase/articles/889386-developer-information-overview for further details.
License: MIT + file LICENSE
URL: https://m-muecke.github.io/worldbank/, https://github.com/m-muecke/worldbank
BugReports: https://github.com/m-muecke/worldbank/issues
Depends: R (≥ 4.1.0)
Imports: httr2 (≥ 1.1.0), stats, tools, utils
Suggests: ggplot2, scales, testthat (≥ 3.3.0), withr
Config/roxygen2/markdown: TRUE
Config/roxygen2/version: 8.1.0
Config/testthat/edition: 3
Config/testthat/parallel: true
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2026-10-02 09:23:11 UTC; mmuecke
Author: Maximilian Mücke ORCID iD [aut, cre]
Maintainer: Maximilian Mücke <muecke.maximilian@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-02 10:10:02 UTC

worldbank: Client for the 'World Bank' APIs

Description

Download and search data from the 'World Bank' APIs, including the 'Indicators' API, the 'Poverty and Inequality Platform (PIP)' API, the 'Finances One' API, the 'Projects' API, and the 'Documents & Reports' API. See https://datahelpdesk.worldbank.org/knowledgebase/articles/889386-developer-information-overview for further details.

Options

Author(s)

Maintainer: Maximilian Mücke muecke.maximilian@gmail.com (ORCID)

Authors:

See Also

Useful links:


Get or manage the worldbank API cache

Description

wb_cache_dir() returns the path where cached API responses are stored. wb_cache_clear() clears all cached responses.

Usage

wb_cache_dir()

wb_cache_clear()

wb_cache_delete()

Details

The cache is only used when enabled with options(worldbank.cache = TRUE).

Each API's caching headers decide whether and for how long a cached response is reused, so the cache helps more with some APIs than others. Indicators API responses are reused for up to a day. Projects and Documents & Reports API responses are checked with the API on every call, which only saves downloading them again. Finances One and PIP API responses are never cached.

Cached responses older than 1 day are deleted. Change this with options(worldbank.cache_max_age = seconds). A higher value doesn't make responses be reused for longer than the API allows.

Value

wb_cache_dir() returns a string with the path to the cache directory.

wb_cache_clear() is called for its side effect of clearing the cached responses and returns NULL invisibly.

Examples

## Not run: 
# enable caching
options(worldbank.cache = TRUE)

# view cache location
wb_cache_dir()

# clear the cache
wb_cache_clear()

## End(Not run)

Return Finances One API data

Description

Return Finances One API data

Usage

fone_dataset(dataset_id, resource_id, ..., limit = NULL)

fone_view(view_id, ..., limit = NULL)

Arguments

dataset_id

(character(1))
The ID of the associated dataset.

resource_id

(character(1))
The ID of the associated resource.

...

(any)
Additional arguments passed to the request.

limit

(NULL | integer(1))
The maximum number of rows to return. Default NULL. If NULL, all rows are returned.

view_id

(character(1))
The ID of the view.

Value

A data.frame() with the requested dataset.

Source

https://financesone.worldbank.org/data

Examples

## Not run: 
# get dataset data
dataset <- fone_dataset(dataset_id = "DS00047", resource_id = "RS00005")
head(dataset)

# get view data
view <- fone_view(view_id = "DS01538")
head(view)

## End(Not run)

Return auxiliary data tables

Description

Return auxiliary data tables

Usage

pip_aux(
  table = NULL,
  release_version = NULL,
  ppp_version = NULL,
  version = NULL
)

Arguments

table

(NULL | character(1))
Table to be returned. Default NULL.

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A character() with the available tables, or a data.frame() with the table data.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_citation(), pip_cp(), pip_data(), pip_group(), pip_health_check(), pip_info(), pip_valid_params(), pip_versions()

Examples



# get a list of available tables
pip_aux()

# get countries
aux <- pip_aux("countries")
head(aux)

# get GDP
aux <- pip_aux("gdp")
head(aux)

# get CPI
aux <- pip_aux("cpi")
head(aux)



Return citation for a given version

Description

Return citation for a given version

Usage

pip_citation(release_version = NULL, ppp_version = NULL, version = NULL)

Arguments

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A data.frame() with the citation.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_cp(), pip_data(), pip_group(), pip_health_check(), pip_info(), pip_valid_params(), pip_versions()

Examples



pip_citation()



Return country profile data

Description

Return country profile data

Usage

pip_cp(
  country = NULL,
  povline = NULL,
  release_version = NULL,
  ppp_version = NULL,
  version = NULL
)

Arguments

country

(NULL | character())
Countries for which statistics are to be computed, specified as ISO3 codes. Default NULL.

povline

(NULL | numeric(1))
Poverty line to be used to compute poverty measures, between 0 and 2700. Poverty lines are only accepted up to 3 decimals. Default NULL, which uses the international poverty line of the requested ppp_version, e.g. 3 for 2021 PPPs and 2.15 for 2017 PPPs.

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A data.frame() with country profile statistics including headcount ratios, inequality measures, and demographic breakdowns.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_data(), pip_group(), pip_health_check(), pip_info(), pip_valid_params(), pip_versions()

Examples



cp <- pip_cp("ZAF")
head(cp)



Return main poverty and inequality statistics

Description

Return main poverty and inequality statistics

Usage

pip_data(
  country = NULL,
  year = NULL,
  povline = NULL,
  popshare = NULL,
  fill_gaps = FALSE,
  nowcast = FALSE,
  welfare_type = c("all", "consumption", "income"),
  reporting_level = c("all", "national", "rural", "urban"),
  additional_ind = FALSE,
  release_version = NULL,
  ppp_version = NULL,
  version = NULL
)

Arguments

country

(NULL | character())
Countries for which statistics are to be computed, specified as ISO3 codes. Default NULL.

year

(NULL | character() | numeric())
Years for which statistics are to be computed, specified as YYYY, or "all" for every available year or "MRV" for the most recent year. Default NULL, which returns every available year.

povline

(NULL | numeric(1))
Poverty line to be used to compute poverty measures, between 0 and 2700. Poverty lines are only accepted up to 3 decimals. Default NULL, which uses the international poverty line of the requested ppp_version, e.g. 3 for 2021 PPPs and 2.15 for 2017 PPPs.

popshare

(NULL | numeric(1))
Proportion of the population living below the poverty line, between 0 and 1. Takes precedence over povline: if both are supplied, the poverty line is derived from popshare. Default NULL.

fill_gaps

(logical(1))
Whether to fill gaps in the data. Default FALSE.

nowcast

(logical(1))
Whether to include nowcast estimates. Requires fill_gaps = TRUE. Default FALSE.

welfare_type

(character(1))
Type of welfare measure to be used. Default "all".

reporting_level

(character(1))
Level of reporting for the statistics. Default "all".

additional_ind

(logical(1))
Whether to include additional indicators. Default FALSE.

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A data.frame() with the requested statistics.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_group(), pip_health_check(), pip_info(), pip_valid_params(), pip_versions()

Examples



data <- pip_data(c("ZAF", "ZMB"))
head(data)



Return aggregation of PIP statistics

Description

Return aggregation of PIP statistics

Usage

pip_group(
  country = NULL,
  year = NULL,
  povline = NULL,
  popshare = NULL,
  group_by = c("wb", "none"),
  fill_gaps = FALSE,
  welfare_type = c("all", "consumption", "income"),
  reporting_level = c("all", "national", "rural", "urban"),
  additional_ind = FALSE,
  release_version = NULL,
  ppp_version = NULL,
  version = NULL
)

Arguments

country

(NULL | character())
Countries for which statistics are to be computed, specified as ISO3 codes. Default NULL.

year

(NULL | character() | numeric())
Years for which statistics are to be computed, specified as YYYY, or "all" for every available year or "MRV" for the most recent year. Default NULL, which returns every available year.

povline

(NULL | numeric(1))
Poverty line to be used to compute poverty measures, between 0 and 2700. Poverty lines are only accepted up to 3 decimals. Default NULL, which uses the international poverty line of the requested ppp_version, e.g. 3 for 2021 PPPs and 2.15 for 2017 PPPs.

popshare

(NULL | numeric(1))
Proportion of the population living below the poverty line, between 0 and 1. Takes precedence over povline: if both are supplied, the poverty line is derived from popshare. Default NULL.

group_by

(character(1))
Aggregate results by pre-defined sub-groups. Default "wb".

fill_gaps

(logical(1))
Whether to fill gaps in the data. Default FALSE.

welfare_type

(character(1))
Type of welfare measure to be used. Default "all".

reporting_level

(character(1))
Level of reporting for the statistics. Default "all".

additional_ind

(logical(1))
Whether to include additional indicators. Default FALSE.

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A data.frame() with the requested statistics.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_data(), pip_health_check(), pip_info(), pip_valid_params(), pip_versions()

Examples



grp <- pip_group(c("AFE", "LAC"))
head(grp)



Determine if the API is running and listening as expected

Description

Determine if the API is running and listening as expected

Usage

pip_health_check()

Value

A character(1) with the health check message.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_data(), pip_group(), pip_info(), pip_valid_params(), pip_versions()

Examples



pip_health_check()



Return information about the API

Description

Return information about the API

Usage

pip_info()

Value

A list() with the API information.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_data(), pip_group(), pip_health_check(), pip_valid_params(), pip_versions()

Examples



pip_info()



Return valid query parameters

Description

Return valid query parameters

Usage

pip_valid_params(
  endpoint = c("all", "aux", "pip", "pip-grp", "pip-info", "valid-params"),
  release_version = NULL,
  ppp_version = NULL,
  version = NULL
)

Arguments

endpoint

(character(1))
Endpoint for which valid parameters are to be returned. Default "all".

release_version

(NULL | character(1) | numeric(1))
Version of the data release in YYYYMMDD format. Default NULL.

ppp_version

(NULL | character(1) | numeric(1))
Version of the data in YYYY format. Default NULL.

version

(NULL | character(1))
Version of the data. Default NULL.

Value

A data.frame() with the valid parameters.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_data(), pip_group(), pip_health_check(), pip_info(), pip_versions()

Examples



params <- pip_valid_params()
head(params)



Return the available data versions

Description

Return the available data versions

Usage

pip_versions()

Value

A data.frame() with the available versions.

Source

https://pip.worldbank.org/api

See Also

Other poverty and inequality statistics: pip_aux(), pip_citation(), pip_cp(), pip_data(), pip_group(), pip_health_check(), pip_info(), pip_valid_params()

Examples



vers <- pip_versions()
head(vers)



World Bank WDI bulk download

Description

Download the entire World Development Indicators dataset as a single zip and return its contents as a list of data frames. Useful for full-dataset analyses where paginating through wb_data() would be slow, and for accessing footnote and series-time metadata that the API does not expose.

Usage

wb_bulk(timeout = 600L)

Arguments

timeout

(integer(1))
Maximum download time in seconds. Default 600.

Details

The download is roughly 280 MB compressed and may take a minute or more.

Value

A named list() of data.frame()s:

Source

https://databankfiles.worldbank.org/public/ddpext_download/WDI_CSV.zip

See Also

Other indicators data: wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples

## Not run: 
wdi <- wb_bulk()
head(wdi$data)

## End(Not run)

World Bank country data

Description

List all countries supported by the World Bank API.

Usage

wb_country(
  country = NULL,
  lang = "en",
  region = NULL,
  income_level = NULL,
  lending_type = NULL
)

Arguments

country

(NULL | character())
Country to query. Default NULL. If NULL, all countries are returned.

lang

(character(1))
Language to query. Default "en".

region

(NULL | character())
Region codes to filter by, as listed in the code column of wb_region(). Default NULL.

income_level

(NULL | character())
Income level IDs to filter by, as listed by wb_income_level(). Default NULL.

lending_type

(NULL | character())
Lending type IDs to filter by, as listed by wb_lending_type(). Default NULL.

Value

A data.frame() with the available countries. The columns are:

Source

https://api.worldbank.org/v2/country

See Also

Other indicators data: wb_bulk(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



country <- wb_country()
head(country)

# low income countries in Sub-Saharan Africa
wb_country(region = "SSF", income_level = "LIC")



World Bank country indicator data

Description

List all country indicators supported by the World Bank API.

Usage

wb_data(
  indicator = "NY.GDP.MKTP.CD",
  country = NULL,
  lang = "en",
  start_date = NULL,
  end_date = NULL,
  mrv = NULL,
  mrnev = NULL,
  gapfill = FALSE,
  footnote = FALSE,
  source = NULL
)

wb_country_indicator(
  indicator = "NY.GDP.MKTP.CD",
  country = NULL,
  lang = "en",
  start_date = NULL,
  end_date = NULL,
  mrv = NULL,
  mrnev = NULL,
  gapfill = FALSE,
  footnote = FALSE,
  source = NULL
)

Arguments

indicator

(character())
Indicators to query.

country

(NULL | character())
Countries to query. Default NULL. If NULL, all countries are returned.

lang

(character(1))
Language to query. Default "en".

start_date

(NULL | character(1) | integer(1))
Start date to query. Default NULL. Supported formats:

  • YYYY for yearly data (e.g. 2020 or "2020")

  • YYYYQ[1-4] for quarterly data (e.g. "2020Q1")

  • YYYYM[1-12] for monthly data (e.g. "2020M02")

end_date

(NULL | character(1) | integer(1))
End date to query, in the same format as start_date. Default NULL.

mrv

(NULL | integer(1))
Most recent values to return. An alternative to start_date/end_date. Default NULL.

mrnev

(NULL | integer(1))
Most recent non-empty values to return for each country. Unlike mrv, which returns the same most recent dates for every country and drops countries without a value for them, the dates can differ between countries. An alternative to start_date/end_date and mrv. Default NULL.

gapfill

(logical(1))
Whether to fill missing values by carrying forward the last available value. Only used when mrv is set. Default FALSE.

footnote

(logical(1))
Whether to return the footnotes published alongside the observations, such as uncertainty bounds or the survey a figure was derived from. Default FALSE.

source

(NULL | integer(1))
ID of the database to query, as listed by wb_source(). Default NULL, which uses the World Development Indicators for indicators published there. Set this to get an indicator's values from another database, which can differ from those in the World Development Indicators.

Value

A data.frame() with the available country indicators. The columns are:

Source

https://api.worldbank.org/v2/country/{country}/indicator/{indicator}

See Also

Other indicators data: wb_bulk(), wb_country(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



# 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)

# latest available poverty rate for each country, even if from different years
ind <- wb_data("SI.POV.DDAY", c("ALB", "BRA", "IND"), mrnev = 1)
ind[c("country_code", "date", "value")]

# include the per-observation footnotes
ind <- wb_data("SI.POV.DDAY", "ALB", footnote = TRUE)
head(ind[c("date", "value", "footnote")])

# GDP as archived in the Africa Development Indicators, which ends in 2011
ind <- wb_data("NY.GDP.MKTP.CD", "ZAF", source = 11)
head(ind)



World Bank document data

Description

Search the World Bank Documents & Reports archive from the Documents & Reports API.

Usage

wb_document(
  search = NULL,
  country = NULL,
  type = NULL,
  project = NULL,
  start_date = NULL,
  end_date = NULL,
  id = NULL,
  limit = NULL
)

Arguments

search

(NULL | character(1))
Free-text search term. Default NULL.

country

(NULL | character())
Two-character World Bank country code(s) to filter by, e.g. "BR" or c("BR", "IN"). Matching is case insensitive, and documents for any of the given codes are returned. Default NULL.

type

(NULL | character())
Document type(s) to filter by, e.g. "Report" or "Project Appraisal Document". Documents of any of the given types are returned. Default NULL.

project

(NULL | character())
Project ID(s) to filter by, e.g. "P180429". Documents for any of the given projects are returned. Default NULL.

start_date

(NULL | character(1))
Document start date in "YYYY-MM-DD" format. Default NULL.

end_date

(NULL | character(1))
Document end date in "YYYY-MM-DD" format. Default NULL.

id

(NULL | character())
Document ID(s) to filter by, as returned in the id column. Default NULL.

limit

(NULL | integer(1))
The maximum number of documents to return. Default NULL. If NULL, all matching documents are returned, which can take many requests for broad queries.

Value

A data.frame() with World Bank document data. Since a document can have several types, countries, regions, and projects, type, major_type, country_code, country, region, and project_id hold all of them separated by ⁠;⁠, which never occurs within a value. Use strsplit(x, ";") to split them. The columns are:

Source

https://search.worldbank.org/api/v3/wds

Examples



# project appraisal documents for Brazil published in 2024
wb_document(
  country = "BR",
  type = "Project Appraisal Document",
  start_date = "2024-01-01",
  end_date = "2024-12-31"
)

# all documents belonging to a project
wb_document(project = "P180429")

# the first 100 documents mentioning climate
docs <- wb_document(search = "climate", limit = 100)

# the ones covering more than one country
docs[grepl(";", docs$country_code), c("title", "country_code")]



World Bank income level data

Description

List all income levels supported by the World Bank API.

Usage

wb_income_level(income = NULL, lang = "en")

Arguments

income

(NULL | character())
Income level to query. Default NULL. If NULL, all levels are returned.

lang

(character(1))
Language to query. Default "en".

Value

A data.frame() with the available income levels. The columns are:

Source

https://api.worldbank.org/v2/incomeLevels

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



wb_income_level()



World Bank indicator data

Description

List all indicators supported by the World Bank API.

Usage

wb_indicator(indicator = NULL, lang = "en", source = NULL)

Arguments

indicator

(NULL | character(1))
Indicator to query. Default NULL. If NULL, all indicators are returned.

lang

(character(1))
Language to query. Default "en".

source

(NULL | integer(1))
ID of the source to query, as listed by wb_source(). Default NULL, which uses the API default.

Value

A data.frame() with the available indicators. Since an indicator can have several topics, topic_id and topic_value hold all of them separated by ⁠;⁠, which never occurs within a value, or NA if there are none. Use strsplit(x, ";") to split them, or a pattern such as "(^|;)Health(;|$)" to match a single topic exactly. The columns are:

Source

https://api.worldbank.org/v2/indicator

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



wb_indicator("NY.GDP.MKTP.CD")

# an indicator can have several topics, separated by `;`
ind <- wb_indicator("SE.ENR.PRSC.FM.ZS")
ind[c("topic_id", "topic_value")]
strsplit(ind$topic_value, ";")



World Bank available languages

Description

List all languages supported by the World Bank API.

Usage

wb_language()

Value

A data.frame() with the available languages. The columns are:

Source

https://api.worldbank.org/v2/languages

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_lending_type(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



wb_language()



World Bank lending type data

Description

List all lending types supported by the World Bank API.

Usage

wb_lending_type(type = NULL, lang = "en")

Arguments

type

(NULL | character())
Lending type to query. Default NULL. If NULL, all types are returned.

lang

(character(1))
Language to query. Default "en".

Value

A data.frame() with the available lending types. The columns are:

Source

https://api.worldbank.org/v2/lendingTypes

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_region(), wb_search(), wb_source(), wb_topic()

Examples



wb_lending_type()



World Bank project data

Description

Query World Bank project data from the Projects API.

Usage

wb_project(
  id = NULL,
  country = NULL,
  status = NULL,
  region = NULL,
  search = NULL,
  start_date = NULL,
  end_date = NULL,
  limit = NULL
)

Arguments

id

(NULL | character())
Project ID(s) to query, e.g. "P163868" or c("P163868", "P180429"). Default NULL. If provided, other filters are ignored.

country

(NULL | character())
Two-character World Bank country code(s) to filter by, e.g. "BR" or c("BR", "IN"). Regional aggregates such as "1W" (World) or "3A" (Africa) are also accepted. Matching is case insensitive, and projects for any of the given codes are returned. Default NULL.

status

(NULL | character())
Project status(es) to filter by, each one of "active", "closed", "dropped", or "pipeline". Projects with any of the given statuses are returned. Default NULL.

region

(NULL | character())
Region name(s) to filter by, e.g. "South Asia". Matching is case insensitive and by substring, so "Africa" also matches "Eastern and Southern Africa" and "Middle East and North Africa". Projects matching any of the given names are returned. Default NULL.

search

(NULL | character(1))
Free-text search term. Default NULL.

start_date

(NULL | character(1))
Board approval start date in "YYYY-MM-DD" format. Default NULL.

end_date

(NULL | character(1))
Board approval end date in "YYYY-MM-DD" format. Default NULL.

limit

(NULL | integer(1))
The maximum number of projects to return. Default NULL. If NULL, all matching projects are returned, which can take many requests for broad queries. Projects are returned in descending order of id, so the most recently created projects come first.

Value

A data.frame() with World Bank project data. The columns are:

Source

https://search.worldbank.org/api/v2/projects

Examples



# active projects in Brazil related to education
wb_project(country = "BR", status = "active", search = "education")

# active or pipeline projects across two countries
wb_project(country = c("BR", "IN"), status = c("active", "pipeline"))

# look up specific projects
wb_project(id = c("P163868", "P180429"))

# the first 100 projects mentioning climate
wb_project(search = "climate", limit = 100)



World Bank region data

Description

List all regions supported by the World Bank API.

Usage

wb_region(region = NULL, lang = "en")

Arguments

region

(NULL | character())
Region to query. Default NULL. If NULL, all regions are returned.

lang

(character(1))
Language to query. Default "en".

Value

A data.frame() with the available regions. The columns are:

Source

https://api.worldbank.org/v2/region

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_search(), wb_source(), wb_topic()

Examples



region <- wb_region()
head(region)



Description

Search the indicator catalog returned by wb_indicator() for a regular expression pattern across one or more text fields. By default the match is case insensitive.

Usage

wb_search(
  pattern,
  fields = c("id", "name", "source_note"),
  catalog = NULL,
  lang = "en",
  ignore.case = TRUE,
  fixed = FALSE,
  source = NULL,
  ...
)

Arguments

pattern

(character(1))
Regular expression to match.

fields

(character())
Columns of the indicator catalog to search. Default c("id", "name", "source_note").

catalog

(NULL | data.frame())
Optional pre-fetched indicator catalog. If NULL (default), wb_indicator() is called.

lang

(character(1))
Language to query. Only used when catalog is NULL. Default "en".

ignore.case

(logical(1))
Whether the match should be case insensitive. Default TRUE.

fixed

(logical(1))
Whether to match pattern as a literal string. See grepl() for details. Default FALSE.

source

(NULL | integer(1))
ID of the source to query, as listed by wb_source(). Only used when catalog is NULL. Default NULL, which uses the API default.

...

(any)
Additional arguments passed to grepl().

Value

A data.frame() with the matching rows of the indicator catalog.

Source

https://api.worldbank.org/v2/indicator

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_source(), wb_topic()

Examples



# search for indicators related to GDP
wb_search("GDP")

# restrict the search to the indicator name
wb_search("unemployment", fields = "name")

# search the topics associated with each indicator
wb_search("Climate Change", fields = "topic_value")

# literal match
wb_search("(% of GDP)", fixed = TRUE)



World Bank source data

Description

List all sources supported by the World Bank API.

Usage

wb_source(source = NULL, lang = "en")

Arguments

source

(NULL | character())
Source to query. Default NULL. If NULL, all sources are returned.

lang

(character(1))
Language to query. Default "en".

Value

A data.frame() with the available sources. The columns are:

Source

https://api.worldbank.org/v2/sources

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_topic()

Examples



src <- wb_source()
head(src)



World Bank topic data

Description

List all topics supported by the World Bank API.

Usage

wb_topic(topic = NULL, lang = "en")

Arguments

topic

(NULL | character())
Topic to query. Default NULL. If NULL, all topics are returned.

lang

(character(1))
Language to query. Default "en".

Value

A data.frame() with the available topics. The columns are:

Source

https://api.worldbank.org/v2/topics

See Also

Other indicators data: wb_bulk(), wb_country(), wb_data(), wb_income_level(), wb_indicator(), wb_language(), wb_lending_type(), wb_region(), wb_search(), wb_source()

Examples



topic <- wb_topic()
head(topic)