knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The NOAAeq
package analyses data from the Significant Earthquake Database of the U.S. National Oceanographic and Atmospheric Administration (NOAA). This dataset contains information about 5,933 earthquakes over an approximately 4,000 year time span.
The package has 3 main functionalities:
Data cleaning
Timeline plots
Interactive leaflet maps
Here is an example of a timeline plot for the USA, covering the recent period 2000-2017.
require("knitr") require("NOAAeq") require("magrittr") opts_knit$set(root.dir = system.file("extdata", package = "NOAAeq"))
data <- readr::read_delim(file = "earthquakes.tsv.gz", delim = "\t")
data %>% eq_clean_data() %>% dplyr::filter(lubridate::year(DATE) %in% 2000:2017 & COUNTRY == "USA") %>% ggplot(aes(x = DATE, size = EQ_PRIMARY, fill = TOTAL_DEATHS)) + geom_timeline() + theme_classic() + theme(legend.position = "bottom") + scale_size_continuous(name = "Richter scale value") + scale_fill_continuous(name = "# deaths") + guides(size = guide_legend(order = 1), fill = guide_colourbar(order = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.