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.
The quaker
API exposes 6 functions.
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)
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)
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))
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
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.