In previous posts I demonstrated R plots created using World Bank Data through their API. The following is a much nicer example of what is possible. Many thanks to Vincent Arel-Bundock for sharing his work to make the World Bank Development Indicator API data available as an R package! He also provided comments in a previous post that show great examples of the use of the API (the results of which are pictured above).
In only 4 lines of code, the graph above is created with data straight from the World Bank. This example requires the ggplot2 library as well as the new WDI library. WDI is used to return a data frame that is passed to ggplot to produce the graph.
There is a reference manual that describes the use of ggplot2 in greater detail. Oh – one other note. I generally save charts using the png command. This did not work with ggplot2, I needed to create the chart in R and then executed the following command:
To leave a comment for the author, please follow the link and comment on their blog: R-Chart.