1 The WDI package

  • The World Development Indicators (WDI) package is a R package to download and use the World Bank’s World Development Indicators database.
  • WDI package
# Install WDI package
install.packages("WDI")

2 Load WDI package and search the data

# Load WDI package
library(WDI)

# Search GDP, PPP
WDIsearch("GDP, PPP")
##                  indicator                                            name
## 1558  BG.KAC.FNEI.GD.PP.ZS     Gross private capital flows (% of GDP, PPP)
## 1560  BG.KLT.DINV.GD.PP.ZS Gross foreign direct investment (% of GDP, PPP)
## 11422    NY.GDP.MKTP.PP.CD              GDP, PPP (current international $)
## 11423    NY.GDP.MKTP.PP.KD        GDP, PPP (constant 2017 international $)
## 11424 NY.GDP.MKTP.PP.KD.87        GDP, PPP (constant 1987 international $)
## 17833 TG.VAL.TOTL.GD.PP.ZS                           Trade (% of GDP, PPP)
# Search GDP per capita, PPP
WDIsearch("GDP per capita, PPP")
##                  indicator                                                 name
## 717     6.0.GDPpc_constant GDP per capita, PPP (constant 2011 international $) 
## 11434    NY.GDP.PCAP.PP.CD        GDP per capita, PPP (current international $)
## 11435    NY.GDP.PCAP.PP.KD  GDP per capita, PPP (constant 2017 international $)
## 11436 NY.GDP.PCAP.PP.KD.87  GDP per capita, PPP (constant 1987 international $)
## 11437 NY.GDP.PCAP.PP.KD.ZG                GDP per capita, PPP annual growth (%)

3 Download and use the data

  • NY.GDP.MKTP.KD.ZG GDP growth (annual %)
  • NY.GDP.MKTP.PP.KD GDP, PPP (constant 2017 international $)
  • NY.GDP.PCAP.PP.KD GDP per capita, PPP (constant 2017 international $)
  • HD.HCI.OVRL Human capital index (HCI) (scale 0-1)
  • IC.BUS.DFRN.XQ Ease of doing business score (0 = lowest performance to 100 = best performance)
# Download the WDI data
WDI <- WDI(indicator = c("GDP_PPP" = "NY.GDP.MKTP.PP.KD", 
                         "GDP_per_capita" = "NY.GDP.PCAP.PP.KD",
                         "GDP_growth" = "NY.GDP.MKTP.KD.ZG",
                         "Ease_business" = "IC.BUS.DFRN.XQ"), 
              start = 1989, end = 2023)

# Save the data as CSV
write.csv(WDI, "Data_raw/WDI.csv")