Svetlana Aksyuk
16 Apr. 2017
Select one of four indicators of GDP per capita
Choose year
Generate choroplet world map
Measure inequality among countries with Gini coefficient: coefficient of 1 (or 100%) expresses maximal inequality among values
See top and low 5 countries by chosen indicator
“Select year” slider:
“Select indicator to plot” radio button:
GDP per capita available in constant and current prices, in US dollars and at purchasing power parity
The application downloads data from the World Bank database via API
If \( n \) is number of countries, \( x_i \) – GDP per capita of country \( i \):
\[
G = \sum_{i = 1}^n \sum_{j = 1}^n \big | x_i - x_j \big | \bigg / \bigg ( 2 n \sum_{i = 1}^n x_i \bigg )
\]
Gini index for GDP per capita (current US$) in 2015:
library('WDI'); library('reldist')
DT <- na.omit(data.frame(WDI('all', 'NY.GDP.PCAP.CD',
2015, 2015))[48:264, ])
head(DT, n = 2)
iso2c country NY.GDP.PCAP.CD year
48 AF Afghanistan 594.3231 2015
49 AL Albania 3945.2176 2015
round(gini(DT[, 3]), 2)
[1] 0.64
See a map and test this app at aksyuk.shinyapps.io/worldmap_gdp/
Documentation: README.md