26 Apr 2016 08:00 googleVis ,R ,wbstats ,World Bank No comments
Similarly to the
wbstats offers an interface to the World Bank database.
With the functions of
wbstats the World Bank data can be searched and data for several indicators requested. Unlike
WDI , the data is returned in a ‘long’ table with one column for all values and a separate column for the indicators. Additionally, the function
wb allows me to specify how many most recent values (
mrv ) I am interested.
Thus, to recreate the famous Gapminder chart by Hans Rosling , showing the correlation between fertility, i.e. number of children per woman, and life expectancy over time by country and region, I can write:
R version 3.2.4 (2016-03-10) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.4 (El Capitan) locale:  en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages:  stats graphics grDevices utils datasets  methods base other attached packages:  googleVis_0.5.10 data.table_1.9.6 wbstats_0.1 loaded via a namespace (and not attached):  httr_1.1.0 R6_2.1.2 rsconnect_0.4.2.1  tools_3.2.4 curl_0.9.7 RJSONIO_1.3-0  jsonlite_0.9.19 chron_2.3-47