The quaker API allows users to retrieve, analyse and visualize global seismic activity. The data used is available on the Earthquake Hazards Program sections of the USGS website.

quaker package info

The quaker API exposes 6 functions.

  1. get_seismic_data(timeFrame, minMagnitude)
  2. returns a GeoJson formatted document of global seismic activity
  3. get_freq_grp_by_day_mag(geoJson)
  4. Returns summary information ina dataframe of frequency grouped by magnitude by day
  5. get_freq_grp_by_country_mag(geoJson)
  6. returns a dataframe of frequency grouped by magnitude by country
  7. flatten_to_table(geoJson)
  8. returns a data frame containing fields 'longtiude','latitude','depth','magnitude','tsunami' , 'time'
  9. fit_quaker(geoJson)
  10. fits a logistic regression model $$tsunami \sim longtiude + latitude + depth + magnitude$$, returns a list of objects including model fit and anova objects
  11. plot(geoJson)
  12. Plots an object of type seismic_geojson. Using leaflet creates map of the world with pins at the correct latitude/longtitude for each earthquake in the geoJson object. Each pin has a toop tip which when clicked provides futher information on the seismic event.

Example 1

Download all the seismic events records by the USGS for the past month with magnitude greater than 2.5 on the Richter scale. Group the the frequency by country and magnitude and order by total number of seismic events per country descending.

library(quaker)
library(dplyr)

Gr

data <- get_seismic_data(timeFrame = 'PAST_MONTH', minMagnitude = '2.5')
grp_by_cntry_mag <- get_freq_grp_by_country_mag(data)
grp_by_cntry_mag = grp_by_cntry_mag %>% arrange(desc(total)) %>% head
knitr::kable(grp_by_cntry_mag)

Example 2

Download all the seismic events records by the USGS for the past week with any magnitude. Group the the frequency by day and magnitude and order by total number of seismic events per day descending.

data <- get_seismic_data(timeFrame = 'PAST_WEEK', minMagnitude = 'all')
grp_by_day_mag <- get_freq_grp_by_day_mag(data)
knitr::kable(grp_by_day_mag)

Example 3

Download all the seismic events records by the USGS for the past week with any magnitude. Flatten the Geojson object to data frame for ease of manupulation Returning the fields

data <- get_seismic_data(timeFrame = 'PAST_WEEK', minMagnitude = 'all')
data_flat <- flatten_to_table(data)
knitr::kable(head(data_flat))

Example 4

Download all the seismic events records by the USGS for the past month with any magnitude. Fit a logistic regression $$tsunami \sim longtiude + latitude + depth + magnitude$$

```r data <- get_seismic_data(timeFrame = 'PAST_MONTH', minMagnitude = 'all') model.fit <- fit_quaker(data)

```r
model.fit$fit
model.fit$fit.anova

Example 5

Download all the seismic events records by the USGS for the past week with magnitude greater than 2.5. Plot map of world with pins showsing event location and pin tooltip with more details of the event

this_week_2_5 <- get_seismic_data(timeFrame = 'PAST_WEEK', minMagnitude = '2.5')
plot(this_week_2_5)


iant04128591/quaker documentation built on May 18, 2019, 1:28 a.m.