googleVis 0.2.17 is released: Displaying earth quake data

The next version of the googleVis package has been released on the project site and CRAN.

This version provides updates to the package vignette and a new example for the gvisMerge function. The new sections of the vignette have been featured on this blog in more detail earlier:

Additionally two little bugs were fixed:
  • Data frames with one row only were not displayed in a chart. Thanks to Oliver Jay and Wai Tung Ho for reporting this issue.
  • The example in the gvisGeoChart help file, which scraps data from to display earth quakes of the last 30 days with magnitude ≥ 4.0, didn’t display the magnitude correctly. The variable Mag was read as a factor rather than numeric. Thanks to Jason Law, who highlighted this point. Here is the now working example.

The size of the bubbles reflect the magnitude and the colour shows the depth of the earthquakes in km.

## Plot world wide earth quakes of the last 30 days with magnitude >= 4.0 
## Get earthquake data of the last 30 days
eq <- readHTMLTable(readLines(""),
 colClasses=c("factor", rep("numeric", 4), "factor"), which=2)
## Create a lat:long location variable
eq$loc=paste(eq$LAT, eq$LON, sep=":")
## Create a geo chart
G <- gvisGeoChart(eq, "loc", "DEPTH km", "MAG",
                   colorAxis="{colors:['purple', 'red', 'orange', 'grey']}",
                   backgroundColor="lightblue"), chartid="EQ")
## Display geo chart in local web browser
fn <- plot(G)
## You find the HTML file fn here

Setting the region argument to ‘IR’ highlights the recent (11 August 2012) earth quake in north-west Iran near Tabriz and Ahar, which caused the death of hundreds and injured thousands.

IR <- gvisGeoChart(eq, "loc", "DEPTH km", "MAG",
                  options=list(displayMode="Markers", region="IR",
                  colorAxis="{colors:['purple', 'red', 'orange', 'grey']}",
                  backgroundColor="lightblue"), chartid="Iran")
## R version 2.15.1 (2012-06-22)
## Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## other attached packages:
## [1] googleVis_0.2.17 RJSONIO_0.98-1   XML_3.9-4       
## loaded via a namespace (and not attached):
## [1] tools_2.15.1


For attribution, please cite this work as:

Markus Gesmann (Aug 13, 2012) googleVis 0.2.17 is released: Displaying earth quake data. Retrieved from

BibTeX citation:

@misc{ 2012-googlevis-0.2.17-is-released-displaying-earth-quake-data,
 author = { Markus Gesmann },
 title = { googleVis 0.2.17 is released: Displaying earth quake data },
 url = { },
 year = { 2012 }
 updated = { Aug 13, 2012 }