WDI

R package to download World Bank data

https://github.com/vincentarelbundock/wdi

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 7 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.3%) to scientific vocabulary

Keywords from Contributors

easystats predict correlation bayes-factors gaussian-graphical-models insight names predictors shiny marginal-effects
Last synced: 10 months ago · JSON representation

Repository

R package to download World Bank data

Basic Info
Statistics
  • Stars: 224
  • Watchers: 25
  • Forks: 60
  • Open Issues: 2
  • Releases: 2
Created over 14 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog

README.md

World Bank data in R

The WDI package allows users to search and download data from over 40 datasets hosted by the World Bank, including the World Development Indicators (‘WDI’), International Debt Statistics, Doing Business, Human Capital Index, and Sub-national Poverty indicators.

CRAN downloads R build
status <!-- badges: end -->

Installation

WDI is published on CRAN and so can be installed by simply typing this in the R console:

r install.packages('WDI')

To install the development version of the package, use remotes:

r library(remotes) install_github('vincentarelbundock/WDI')

Searching for data

You can search for data by using keywords in WDIsearch. For instance, if you are looking for data on Gross Domestic Product:

r WDIsearch('gdp')

Which produces this:

``` r

WDIsearch('gdp')[1:10,] indicator name
[1,] "BG.GSR.NFSV.GD.ZS" "Trade in services (% of GDP)"
[2,] "BM.KLT.DINV.GD.ZS" "Foreign direct investment, net outflows (% of GDP)"
[3,] "BN.CAB.XOKA.GD.ZS" "Current account balance (% of GDP)"
[4,] "BN.CUR.GDPM.ZS" "Current account balance excluding net official capital grants (% of GDP)" [5,] "BN.GSR.FCTY.CD.ZS" "Net income (% of GDP)"
[6,] "BN.KLT.DINV.CD.ZS" "Foreign direct investment (% of GDP)"
[7,] "BN.KLT.PRVT.GD.ZS" "Private capital flows, total (% of GDP)"
[8,] "BN.TRF.CURR.CD.ZS" "Net current transfers (% of GDP)"
[9,] "BNCABFUNDCD_" "Current Account Balance, %GDP"
[10,] "BX.KLT.DINV.WD.GD.ZS" "Foreign direct investment, net inflows (% of GDP)" ```

WDIsearch uses grep and ignores cases, so you can also use regular expressions. For instance, if you are looking for GDP per capita in constant dollars:

r WDIsearch('gdp.*capita.*constant') indicator name [1,] "GDPPCKD" "GDP per Capita, constant US$, millions" [2,] "NY.GDP.PCAP.KD" "GDP per capita (constant 2000 US$)" [3,] "NY.GDP.PCAP.KN" "GDP per capita (constant LCU)" [4,] "NY.GDP.PCAP.PP.KD" "GDP per capita, PPP (constant 2005 international $)"

Download and use the data

Download a series you like for the countries you like:

r dat = WDI(indicator='NY.GDP.PCAP.KD', country=c('MX','CA','US'), start=1960, end=2012)

Look at the data:

r head(dat) iso2c country NY.GDP.PCAP.KD year 1 CA Canada 9374.883 1960 2 CA Canada 9479.824 1961 3 CA Canada 9967.366 1962 4 CA Canada 10290.362 1963 5 CA Canada 10774.653 1964 6 CA Canada 11283.606 1965

Plot the data:

r library(ggplot2) ggplot(dat, aes(year, NY.GDP.PCAP.KD, color=country)) + geom_line() + xlab('Year') + ylab('GDP per capita')

GDP per capita in North America

Note: You can use country='all' to download data for all available countries. You can also feed a vector of indicator strings if you want to download multiple indicators at once.

Monthly or quarterly data

Some World Bank series are available at the monthly or quarterly frequency. You can download those simply using the start and end arguments:

``` r WDI(indicator = 'DPANUSSPB', country = 'CHN', start = '2012M01', end = '2012M05')

iso2c country DPANUSSPB year 1 CHN China 6.324130 2012M05 2 CHN China 6.303810 2012M04 3 CHN China 6.313545 2012M03 4 CHN China 6.300286 2012M02 5 CHN China 6.313091 2012M01 ```

Automatic rename

If the vector that you supply to WDI is named, the function will automatically rename columns where possible.

r dat <- WDI(indicator = c("gdp_per_capita" = "NY.GDP.PCAP.KD", "population" = "SP.POP.TOTL")) head(dat) iso2c country year gdp_per_capita population 1 1A Arab World 2005 5378.379 316264728 2 1A Arab World 2006 5594.899 323773264 3 1A Arab World 2007 5711.663 331653797 4 1A Arab World 2008 5898.516 339825483 5 1A Arab World 2009 5782.422 348145094 6 1A Arab World 2010 5916.330 356508908

Updating series list

To speed up search, WDI ships with a local list of all available WDI series. This list will be updated semi-regularly, but you may still want to update it manually to get access to the very latest data series. To do so, use the cache function:

r WDI_data = WDIcache() WDIsearch('gdp', cache=new_cache)

Developer note: To update the search cache, just save it to the repo:

r save(WDI_data, file = "data/WDI_data.RData")

Bugs, suggestions, etc.

Thanks for using WDI! Please send all bug reports and suggestions through the github issue tracker or by email to vincent.arel-bundock@umontreal.ca

Owner

  • Name: Vincent Arel-Bundock
  • Login: vincentarelbundock
  • Kind: user
  • Location: Montreal, Canada

Political science prof

GitHub Events

Total
  • Issues event: 6
  • Watch event: 12
  • Issue comment event: 1
  • Push event: 10
  • Pull request event: 2
  • Create event: 1
Last Year
  • Issues event: 6
  • Watch event: 12
  • Issue comment event: 1
  • Push event: 10
  • Pull request event: 2
  • Create event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 124
  • Total Committers: 7
  • Avg Commits per committer: 17.714
  • Development Distribution Score (DDS): 0.508
Past Year
  • Commits: 16
  • Committers: 3
  • Avg Commits per committer: 5.333
  • Development Distribution Score (DDS): 0.25
Top Committers
Name Email Commits
Vincent Arel-Bundock v****k@u****a 61
Vincent Arel-Bundock v****l@u****u 44
Etienne Bacher 5****r 8
etiennebacher y****u@e****m 6
Jan Dietrich d****h@p****e 3
olivroy 5****y 1
fao f****o@c****) 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 56
  • Total pull requests: 12
  • Average time to close issues: 12 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 31
  • Total pull request authors: 6
  • Average comments per issue: 3.5
  • Average comments per pull request: 2.33
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: 4 days
  • Average time to close pull requests: about 1 hour
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 0.33
  • Average comments per pull request: 3.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vincentarelbundock (18)
  • etiennebacher (5)
  • pssguy (2)
  • kendonB (2)
  • mabuimo (2)
  • msgoussi (2)
  • sanpi0205 (1)
  • advaitmoharir (1)
  • clemdmcl (1)
  • muuankarski (1)
  • gdkrmr (1)
  • paulecon (1)
  • rastrau (1)
  • mjantti (1)
  • christophergandrud (1)
Pull Request Authors
  • etiennebacher (8)
  • vincentarelbundock (2)
  • olivroy (2)
  • ciakovx (1)
  • MatthieuStigler (1)
  • tscheypidi (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 5,219 last-month
  • Total docker downloads: 44,018
  • Total dependent packages: 7
    (may contain duplicates)
  • Total dependent repositories: 19
    (may contain duplicates)
  • Total versions: 33
  • Total maintainers: 1
cran.r-project.org: WDI

World Development Indicators and Other World Bank Data

  • Versions: 22
  • Dependent Packages: 6
  • Dependent Repositories: 19
  • Downloads: 5,219 Last month
  • Docker Downloads: 44,018
Rankings
Forks count: 1.1%
Stargazers count: 2.2%
Downloads: 5.9%
Dependent repos count: 6.5%
Dependent packages count: 7.3%
Average: 8.1%
Docker downloads count: 26.0%
Last synced: 10 months ago
conda-forge.org: r-wdi
  • Versions: 11
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Forks count: 21.5%
Stargazers count: 25.3%
Average: 27.4%
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • jsonlite * imports
  • curl * suggests
  • testthat * suggests
  • tidyr >= 0.8.0 suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v1 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite