Package 'WDI'

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

Help Index


List of supported languages

Description

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.

Usage

languages_supported()

Details

For example, choosing "vi" (for Vietnamese) will translate "Vietnam" in the dataset but other country names won't be translated and will be empty.

Value

A list of fully and partially supported languages.


WDI: World Development Indicators (World Bank)

Description

Downloads the requested data by using the World Bank's API, parses the resulting XML file, and formats it in long country-year format.

Usage

WDI(
  country = "all",
  indicator = "NY.GDP.PCAP.KD",
  start = 1960,
  end = NULL,
  extra = FALSE,
  cache = NULL,
  latest = NULL,
  language = "en"
)

Arguments

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: c('women_private_sector' = 'BI.PWK.PRVS.FE.ZS')

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 start argument. If NULL, the end date is set to 5 years in the future.

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 WDI::languages_supported(). Default is English.

Details

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

Value

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

Author(s)

Vincent Arel-Bundock [email protected]

Examples

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

World Development Indicators series and country information

Description

A list of two character matrices.

Usage

WDI_data

Format

List of 2 data frames

Details

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.

Description

Download all the WDI indicators at once.

Usage

WDIbulk(timeout = 600)

Arguments

timeout

integer maximum number of seconds to wait for download

Value

Data frame

a list of 6 data frames: Data, Country, Series, Country-Series, Series-Time, FootNote

Author(s)

Vincent Arel-Bundock [email protected]


Update the list of available WDI indicators

Description

Download an updated list of available WDI indicators from the World Bank website. Returns a list for use in the WDIsearch function.

Usage

WDIcache()

Value

Series of indicators, sources and descriptions in two lists list

Note

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.


Search names and descriptions of available WDI series

Description

Data frame with series code, name, description, and source for the WDI series which match the given criteria

Usage

WDIsearch(string = "gdp", field = "name", short = TRUE, cache = NULL)

Arguments

string

Character string. Search for this string using grep with ignore.case=TRUE.

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 WDIcache function. If omitted, WDIsearch will search a local list of series.

Value

Data frame with code, name, source, and description of all series which match the criteria.

Examples

## Not run: 
WDIsearch(string='gdp', field='name', cache=NULL)
WDIsearch(string='AG.AGR.TRAC.NO', field='indicator', cache=NULL)

## End(Not run)