Thirteen lines of code

Thanks to R-bloggers, I discovered that googleVis 0.4.7 with RStudio integration is available on CRAN.

This is great news, but wasn't this that catched my eye. At the end of the post a beautiful map shows a terrible event of the last days: the devastating typhoon track of Haiyan that hit Southeast Asia in November.


It was amazing for me that this plot was created with only 13 lines of code, the following ones:

To be honest, some more break lines will increase code readibility as reported below, but it is wonderful how this plot can be drawn with so few lines of code: two lines about options (loading libraries), nine lines to import data and only one line to produce the plot (and another one to view it!).

Sometimes, also nice things are easy to be obtained.

About Enrico Tonini

I graduated in Statistics in Padua (Italy) in 2009 and took a Phd in Statistics in march 2013. Since april 2013 I have been working as junior statistical consultant and analyst with Quantide.
This entry was posted in R and tagged , , . Bookmark the permalink.

3 Responses to Thirteen lines of code

  1. Pingback: Thirteen lines of code | Milano R net | R for J...

  2. CA says:

    Hi Enrico,

    That's great, but how can one adapt this visualization code to a different table? It looks like your code is mainly based on the url data.

  3. Nicola Sturaro Sommacal says:

    Hi CA,
    If I really meant your question, the first part of the code contains data loading. Of course, the code is specific for the type of data and for the web page. You can re-adapt to use a different page, or substitute all with a simple read.table() if this apply to your case.

    By the way, plot can be drawn at the same way also if your data come from other sources.

    Let me know.

Leave a Reply