noaaQuake

The goal of noaaQuake is to be a package that contains some functions that helps clean, manipulate and visualise the earthquakes data.

The NOAA dataset is available here: https://www.ngdc.noaa.gov/nndc/struts/form?t=101650&s=1&d=1

Installation

You can install the noaaQuakes package by running:

library(devtools)
devtools::install_github("00mathieu/noaaQuake")

Examples

Example 1: cleaning the raw data

library(noaaQuake)

db <- clean_raw_data()

Example 2: visualising a timeline of quakes

library(ggplot2)
ggplot(db[COUNTRY %in%c("CHINA","GREECE")],
       aes (x = as.Date(DATE), 
            y = COUNTRY, 
            color = as.numeric(DEATHS)/1000, 
            size = as.numeric(EQ_PRIMARY))) +
    geom_timeline(aes(xmin = as.Date("2000-01-01"), xmax = as.Date("2018-01-01"))) +
    geom_timeline_label(n_max = 15, aes(label = LOCATION_NAME, xmin = as.Date("2000-01-01"),
                            xmax = as.Date("2018-01-01")))+
    xlab("Date") + ylab("") + ggtitle("Timeline of Earthquakes") +
    labs(size = "Richter scale", color = "# deaths (k)" )+
    theme_bw() +
    theme(legend.position="bottom")

Example 3: leaflet plot visualising location of quake

eq_map(db[COUNTRY %in%c("GREECE") & DATE>"2000-01-01"], annot_col = "popup_text")


00mathieu/noaaQuake documentation built on May 7, 2019, 3:19 p.m.