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.
getWDI(
indicator = "SP.POP.TOTL",
name = NULL,
startDate = 1960,
endDate = format(Sys.Date(), "%Y"),
printURL = FALSE,
outputFormat = "wide"
)
A data frame containing the desired World Bank Indicator
The World Bank official indicator name.
The new name to be used in the column.
The start date for the data to begin
The end date.
Whether the url link for the data should be printed
The format of the data, can be 'long' or 'wide'.
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/
getFAO
, getWDItoSYB
and the WBI package https://cran.r-project.org/package=WDI for an implementation with many more features.