Closed bbest closed 10 years ago
This looks fantastic BB.
I have just finalized the World Bank files, including gapfilling, etc. But I will add this to the README.md for next year (github/ohiprep/Global/WorldBank-Statistics_v2012)
Julie
On Wed, Mar 12, 2014 at 1:58 PM, Ben Best notifications@github.com wrote:
Relevant to Global/WorldBank-WGI_v2013https://github.com/OHI-Science/ohiprep/tree/master/Global/WorldBank-WGI_v2013 .
- R library WDI https://github.com/vincentarelbundock/WDI
Also see:
- GDP https://github.com/datasets/gdp dataset on GitHub which has a process.pyhttps://github.com/datasets/gdp/blob/master/scripts/process.pyscript and conforms to DataPackage http://data.okfn.org/roadmap/core-datasets format
- WorldBank API http://data.worldbank.org/node/11
- Python package wbdata http://wbdata.readthedocs.org/en/latest/
- R library rWBclimate https://github.com/ropensci/rWBclimate for WorldBank Climate APIhttp://data.worldbank.org/developers/climate-data-api
README.md from R library WDI... World Bank Development indicators for R
The World Bank makes available a ton of great data from the World Development Indicators through its web API. The WDI package for R makes it easy to search and download data series from the WDI. Installation
WDI is published on CRAN and so can be installed by simply typing this in the R console:
install.packages('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:
WDIsearch('gdp')
Which produces this:
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:
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:
dat = WDI(indicator='NY.GDP.PCAP.KD', country=c('MX','CA','US'), start=1960, end=2012)
Look at the data:
head(dat) iso2c country NY.GDP.PCAP.KD year1 CA Canada 9374.883 19602 CA Canada 9479.824 19613 CA Canada 9967.366 19624 CA Canada 10290.362 19635 CA Canada 10774.653 19646 CA Canada 11283.606 1965
Plot the data:
library(ggplot2)ggplot(dat, aes(year, NY.GDP.PCAP.KD, color=country)) + geom_line() + xlab('Year') + ylab('GDP per capita')
[image: GDP per capita in North America]https://github.com/vincentarelbundock/WDI/raw/master/web/gdp_per_capita.jpg
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. Updating series list
To speed up search, WDI ships with a local list of all available WDI series as of 2012-06-18. 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:
new_cache = WDIcache()WDIsearch('gdp', cache=new_cache)
Bugs, suggestions, etc.
Thanks for using WDI! Please send all bug reports and suggestions through the github issue tracker or by email at varel@umich.edu
Reply to this email directly or view it on GitHubhttps://github.com/OHI-Science/ohiprep/issues/11 .
Julia Stewart Lowndes, PhD Project Scientist, Ocean Health Index http://www.oceanhealthindex.org National Center for Ecological Analysis and Synthesis (NCEAShttp://www.nceas.ucsb.edu ) University of California, Santa Barbara 735 State Street, Suite 300 Santa Barbara, CA, 93101, USA Phone: 1-805-882-9218
Relevant to Global/WorldBank-WGI_v2013.
Also see:
README.md from R library WDI...
World Bank Development indicators for R
The World Bank makes available a ton of great data from the World Development Indicators through its web API. The
WDI
package forR
makes it easy to search and download data series from the WDI.Installation
WDI
is published on CRAN and so can be installed by simply typing this in theR
console: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:Which produces this:
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:Download and use the data
Download a series you like for the countries you like:
Look at the data:
Plot the data:
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.Updating series list
To speed up search,
WDI
ships with a local list of all available WDI series as of 2012-06-18. 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 thecache
function:Bugs, suggestions, etc.
Thanks for using
WDI
! Please send all bug reports and suggestions through the github issue tracker or by email at varel@umich.edu@gissues:{"order":50,"status":"inprogress"}