Title: | World Development Indicators and Other World Bank Data |
---|---|
Description: | Search and download data from over 40 databases hosted by the World Bank, including the World Development Indicators ('WDI'), International Debt Statistics, Doing Business, Human Capital Index, and Sub-national Poverty indicators. |
Authors: | Vincent Arel-Bundock [aut, cre] , Etienne Bacher [ctb] |
Maintainer: | Vincent Arel-Bundock <[email protected]> |
License: | GPL-3 |
Version: | 2.7.8.9000 |
Built: | 2024-11-15 05:52:15 UTC |
Source: | https://github.com/vincentarelbundock/wdi |
This prints two lists of languages, the fully supported ones and the locally supported ones:
the languages in the category "fully" will return translated names and other info for all countries.
the languages in the category "partially" will return translated names and other info only for the country they represent.
languages_supported()
languages_supported()
For example, choosing "vi" (for Vietnamese) will translate "Vietnam" in the dataset but other country names won't be translated and will be empty.
A list of fully and partially supported languages.
Downloads the requested data by using the World Bank's API, parses the resulting XML file, and formats it in long country-year format.
WDI( country = "all", indicator = "NY.GDP.PCAP.KD", start = 1960, end = NULL, extra = FALSE, cache = NULL, latest = NULL, language = "en" )
WDI( country = "all", indicator = "NY.GDP.PCAP.KD", start = 1960, end = NULL, extra = FALSE, cache = NULL, latest = NULL, language = "en" )
country |
Vector of countries (ISO-2 character codes, e.g. "BR", "US", "CA") for which the data is needed. Using the string "all" instead of individual iso codes pulls data for every available country. |
indicator |
Character vector of indicators codes. See the WDIsearch()
function. If you supply a named vector, the indicators will be automatically
renamed: |
start |
Start date, usually a year in integer format. Must be 1960 or greater. |
end |
End date, usually a year in integer format. Must be greater than
the |
extra |
TRUE returns extra variables such as region, iso3c code, and incomeLevel. See Details. |
cache |
NULL (optional) a list created by WDIcache() to be used with the extra=TRUE argument. |
latest |
Integer indicating the number of most recent non-NA values to get. Default is NULL. If specified, it overrides the start and end dates. |
language |
ISO-2 code in lower case indicating in which language the characters should be provided. List of languages available with |
It is possible to only specify the indicator
and the country
arguments, in which case WDI()
will return data from 1960 to the last year available on World Bank's website. It is also possible to get only the most recent non-NA values, with latest
.
If extra = TRUE
, additional variables are provided:
status: observation status, e.g is the observation a forecast?
iso3c
region
capital: name of the capital city
latitude, longitude
income: income categories of the World Bank
lending
Data frame with country-year observations. You can extract a
data.frame with indicator names and descriptive labels by inspecting the
label
attribute of the resulting data.frame: attr(dat, 'label')
Vincent Arel-Bundock [email protected]
## Not run: WDI(country="all", indicator=c("AG.AGR.TRAC.NO","TM.TAX.TCOM.BC.ZS"), start=1990, end=2000) WDI(country=c("US","BR"), indicator="NY.GNS.ICTR.GN.ZS", start=1999, end=2000, extra=TRUE, cache=NULL) # Rename indicators on the fly WDI(country = 'CA', indicator = c('women_private_sector' = 'BI.PWK.PRVS.FE.ZS', 'women_public_sector' = 'BI.PWK.PUBS.FE.ZS')) # Get the 5 latest non-NA values WDI(country=c("US","BR"), indicator="NY.GNS.ICTR.GN.ZS", latest = 5) ## End(Not run)
## Not run: WDI(country="all", indicator=c("AG.AGR.TRAC.NO","TM.TAX.TCOM.BC.ZS"), start=1990, end=2000) WDI(country=c("US","BR"), indicator="NY.GNS.ICTR.GN.ZS", start=1999, end=2000, extra=TRUE, cache=NULL) # Rename indicators on the fly WDI(country = 'CA', indicator = c('women_private_sector' = 'BI.PWK.PRVS.FE.ZS', 'women_public_sector' = 'BI.PWK.PUBS.FE.ZS')) # Get the 5 latest non-NA values WDI(country=c("US","BR"), indicator="NY.GNS.ICTR.GN.ZS", latest = 5) ## End(Not run)
A list of two character matrices.
WDI_data
WDI_data
List of 2 data frames
The first character matrix includes a full list of WDI series. This list is updated semi-regularly. Users can refresh the list manually using the WDIcache()
function and search in the updated list using the cache
argument.
id WDI indicator code
name Short name of the series
sourceNote Detailed description provided by the source
source Source database
sourceOrganization Source organization
The second character matrix includes extra country information (updated 2012-06-18):
iso3c ISO 3-letter country code
iso2c ISO 2-letter country code
country Country name (long English form)
region Region
capital Capital
longitude Longitude
latitude Latitude
income Income level as defined by the World Bank
lending Lending category, as defined by the World Bank
Download all the WDI indicators at once.
WDIbulk(timeout = 600)
WDIbulk(timeout = 600)
timeout |
integer maximum number of seconds to wait for download |
Data frame
a list of 6 data frames: Data, Country, Series, Country-Series, Series-Time, FootNote
Vincent Arel-Bundock [email protected]
Download an updated list of available WDI indicators from the World Bank website. Returns a list for use in the WDIsearch
function.
WDIcache()
WDIcache()
Series of indicators, sources and descriptions in two lists list
Downloading all series information from the World Bank website can take time.
The WDI
package ships with a local data object with information on all the series
available on 2012-06-18. You can update this database by retrieving a new list using WDIcache
, and then
feeding the resulting object to WDIsearch
via the cache
argument.
Data frame with series code, name, description, and source for the WDI series which match the given criteria
WDIsearch(string = "gdp", field = "name", short = TRUE, cache = NULL)
WDIsearch(string = "gdp", field = "name", short = TRUE, cache = NULL)
string |
Character string. Search for this string using |
field |
Character string. Search this field. Admissible fields: 'indicator', 'name', 'description', 'sourceDatabase', 'sourceOrganization' |
short |
TRUE: Returns only the indicator's code and name. FALSE: Returns the indicator's code, name, description, and source. |
cache |
Data list generated by the |
Data frame with code, name, source, and description of all series which match the criteria.
## Not run: WDIsearch(string='gdp', field='name', cache=NULL) WDIsearch(string='AG.AGR.TRAC.NO', field='indicator', cache=NULL) ## End(Not run)
## Not run: WDIsearch(string='gdp', field='name', cache=NULL) WDIsearch(string='AG.AGR.TRAC.NO', field='indicator', cache=NULL) ## End(Not run)