download_wid: Download data from

Description Usage Arguments Details Value Author(s)

View source: R/download-wid.R


Downloads data from the World Wealth and Income Database ( into a data.frame. Type vignette("wid-demo") for a detailed presentation.


download_wid(indicators = "all", areas = "all", years = "all",
  perc = "all", ages = "all", pop = "all", metadata = FALSE,
  verbose = FALSE)



List of six-letter strings, or "all": code names of the indicators in the database. Default is "all" for all indicators. See 'Details' for more.


List of strings, or "all": area code names of the database. "XX" for countries/regions, "XX-YY" for subregions. Default is "all" for all areas. See 'Details' for more.


Numerical vector, or "all": years to retrieve. Default is "all" for all years.


List of strings, or "all": percentiles take the form "pXX" or "pXXpYY". Default is "all" for all percentiles. See 'Details' for more.


Numerical vector, or "all": age category codes in the database. 999 for all ages, 992 for adults. Default is "all" for all age categories. See 'Details' for more.


List of characters, or "all": type of population. "t" for tax units, "i" for individuals. Default is "all" for all population types. See 'Details' for more.


Should the function fetch metadata too (ie. variable descriptions, sources, methodological notes, etc.)? Default is FALSE.


Should the function indicate the progress of the request? Default is FALSE.


Although all arguments default to "all", you cannot download the entire database by typing download_wid(). The command requires you to specify either some indicators or some areas.

If there is no data matching you selection on (maybe because you specified an indicator or an area that doesn't exist), the command will return NULL with a warning.

All monetary amounts for countries and country subregions are in constant local currency of the reference year (2016). Monetary amounts for world regions are in 2016 EUR PPP. You can access the price index using the indicator inyixx, the PPP exchange rates using xlcusp (USD), xlceup (EUR), xlcyup (CNY), and the market exchange rates using xlcusx (USD), xlceux (EUR), xlcyux (CNY).

Shares and wealth/income ratios are given as a fraction of 1. That is, a top 1% share of 20% is given as 0.2. A wealth/income ratio of 300% is given as 3.

The arguments of the command follow a nomenclature specific to We provide more details below.


The argument indicators is a vector of 6-letter codes that corresponds to a given series type for a given income or wealth concept. The first letter correspond to the type of series. Some of the most common possibilities include:

one-letter code      description
a      average
s      share
t      threshold
m      macroeconomic total
w      wealth/income ratio

See wid_series_type to access the complete list. The next five letters correspond a concept (usually of income and wealth). Some of the most common possibilities include:

five-letter code      description
ptinc      pre-tax national income
pllin      pre-tax labor income
pkkin      pre-tax capital income
fiinc      fiscal income
hweal      net personal wealth

See wid_concepts to access the complete list. For example, sfiinc corresponds to the share of fiscal income, ahweal corresponds to average personal wealth. If you don't specify any indicator, it defaults to "all" and downloads all available indicators.

Area codes

All data in is associated to a given area, which can be a country, a region within a country, an aggregation of countries (eg. a continent), or even the whole world. The argument areas is a vector of codes that specify the areas for which to retrieve data. Countries and world regions are coded using 2-letter ISO codes. Country subregions are coded as XX-YY where XX is the country 2-letter code. See wid_area_codes to access the complete list of area codes. If you don't specify any area, it defaults to "all" and downloads data for all available areas.


All data in correspond to a year. Some series go as far back as the 1800s. The argument years is a vector of integer that specify those years. If you don't specify any year, it defaults to "all" and downloads data for all available years.


The key feature of is that it provides data on the whole distribution, not just totals and averages. The argument perc is a vector of strings that indicate for which part of the distribution the data should be retrieved. For share and average variables, percentiles correspond to percentile ranges and take the form pXXpYY. For example the top 1% share correspond to p99p100. The top 10% share excluding the top 1% is p90p99. Thresholds associated to the percentile group pXXpYY correspond to the minimal income or wealth level that gets you into the group. For example, the threshold of the percentile group p90p100 or p90p91 correspond to the 90% quantile. Variables with no distributional meaning use the percentile p0p100. See for more details. If you don't specify any percentile, it defaults to "all" and downloads data for all available parts of the distribution.

Age groups

Data may only concern the population in a certain age group. The argument ages is a vector of age codes that specify which age categories to retrieve. Ages are coded using 3-digit codes. Some of the most common possibilities include:

three-digit code      description
999      all ages
992      adults, including elderly (20+)
996      adults, excluding elderly (20-65)

See wid_age_codes to access the complete list of age codes. If you don't specify any age, it defaults to "all" and downloads data for all available age groups.

Population types

The data in can refer to different types of population (i.e. different statistical units). The argument pop is a vector of population codes. They are coded using one-letter codes. Some of the most common possibilities include:

one-letter code      description
i      individuals
t      tax units
j      equal-split adults (ie. income or wealth divided equally among spouses)

See wid_population_codes to access the complete list of population types. If you don't specify any code, it defaults to "all" and downloads data for all types of population.


A data.frame with the following columns:


The country or area code.


The variable name, which combine the indicator, the age code and the population code.


The part of the distribution the value relates to.


The year the value relates to.


The value of the indicator.

If you specify metadata=TRUE, the data.frame also has the following columns:


A short version of the variable full name in plain english.


A description of the type of series.


The population type, in plain english.


The age group, in plain english.


The source for the data.


Methodological notes, if any.


Thomas Blanchet

WIDworld/wid-r-tool documentation built on Jan. 7, 2018, 7 a.m.