Learn R Programming

FAOSTAT (version 2.4.0)

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

Value

A data frame containing the desired World Bank Indicator

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.

Original (2011) source by Markus Gesmann: https://lamages.blogspot.it/2011/09/setting-initial-view-of-motion-chart-in.html Also available at https://www.magesblog.com/post/2011-09-25-accessing-and-plotting-world-bank-data/

See Also

getFAO, getWDItoSYB

and the WBI package https://cran.r-project.org/package=WDI for an implementation with many more features.

Examples

Run this code
## pop.df = getWDI()

Run the code above in your browser using DataLab