Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getWDI

Access to World Bank WDI API


Description

A function to extract data from the World Bank API

Please refer to https://data.worldbank.org/ for any difference between the country code system. Further details on World Bank classification and methodology are available on that website.

Usage

getWDI(
  indicator = "SP.POP.TOTL",
  name = NULL,
  startDate = 1960,
  endDate = format(Sys.Date(), "%Y"),
  printURL = FALSE,
  outputFormat = "wide"
)

Arguments

indicator

The World Bank official indicator name.

name

The new name to be used in the column.

startDate

The start date for the data to begin

endDate

The end date.

printURL

Whether the url link for the data should be printed

outputFormat

The format of the data, can be 'long' or 'wide'.

Details

Sometime after 2016, there was a change in the api according to https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation "Version 2 (V2) of the Indicators API has been released and replaces V1 of the API. V1 API calls will no longer be supported. To use the V2 API, you must place v2 in the call. For example: http://api.worldbank.org/v2/country/all/indicator/SP.POP.TOTL.

Value

A data frame containing the desired World Bank Indicator

See Also

getFAO, getWDItoSYB, getFAOtoSYB and the wbstats package https://cran.r-project.org/package=wbstats for an implementation with many more features.

Examples

## pop.df = getWDI()

FAOSTAT

Download Data from the FAOSTAT Database

v2.2.1
GPL (>= 2)
Authors
Michael C. J. Kao <michael.kao@fao.org>, Markus Gesmann, Filippo Gheri
Initial release
2020-11-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.