**The Praise of Insects**, and kindly contributed to R-bloggers)

4:35 am on Saturday morning, I was woken up by a 7.1 magnitude earthquake, the epicentre being approximately 30 km west of where I live in Christchurch, New Zealand. The earthquake was one of the largest that New Zealand has experienced, and has been the most destructive one since the earthquake that struck Napier in 1931. Thankfully, the suburbs around the area that I live in suffered minimal damage, with most roads and houses essentially unscathed.

While the initial earthquake was fairly scary, it has been the aftershocks that have been the most unnerving. By this time we’re starting to get fairly used to them, but they are still keeping all of us on edge. There’s been a number, and now that I have access to the internet, I made it my mission to find out how many there’s been thus far. The New Zealand Herald newspaper has published an online article showing the locations of all the aftershocks, but a bit scant on other details.

The New Zealand research institute Geological and Nuclear Sciences (GNS) is the primary monitor of New Zealand’s earthquakes and makes all their data available online. In particular their Quake Search tool allows you to download CSV, KML and other files of any earthquakes that satisfy any given criteria. The GeoNet website in general is an excellent source of all sorts of information with regard to natural hazards in the New Zealand region.

I downloaded the data for the past week and started pulling out a bunch of trends. The two that I’ll post here for now are the following:

Until 6 Sep 2010 19:03 NZST there has been 257 aftershocks, ranging between 2.4 and 5.4 on the Richter scale. Of these, there have been 64 with magnitudes above 4; 24 above 4.5; and 7 above 5. The average has been 3.6.

The comparison between the earthquakes recorded prior to and following the earthquake is remarkable. The four days prior to the earthquake there were no earthquakes originating within the Canterbury region (defined as being between 42–44 degrees S and 171–173 degrees E). Since Saturday morning, the region has been shaking like nothing else.

A line plot only of the Canterbury earthquakes does show that the aftershocks are lessening in frequency and intensity. Further playing around with the data and the plot might show this more effectively though.

A plot comparing the magnitude of each quake with its depth is quite interesting. The vast majority of the Canterbury earthquakes are fairly shallow (<20 km). Once again, further analysis will show if this is a significant thing or not, but it does explain why they've been so easily felt. Feel free to look at the R code and the CSV file I used for the plots above.

**leave a comment**for the author, please follow the link and comment on their blog:

**The Praise of Insects**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...