This package has the following usage Clean and Visualize NOAA Earthquake Data of Countries. Create timeline plot and interactive map with annotations.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(earthquake)
library(readr)
library(magrittr)
library(dplyr)
library(ggplot2)
#import raw data
data<-read_delim('signif.txt',delim="\t")
#clean country names
eq_location_clean("ECUADOR:  RIOBAMBA, QUITO, CUZCO")
eq_location_clean("TURKEY")
eq_location_clean("China: Jiangsu: Nanjing")
#clean earthquake data
data1<-eq_clean_data(data)
str(data1)
#load cleaned example data of 3 countries
data(eqdata)
str(eqdata)
#timeline plot of INDONEISA
eqdata %>%
  filter(COUNTRY=="INDONESIA") %>%
  ggplot(aes(x=DATE,size=EQ_PRIMARY,fill=TOTAL_DEATHS/10000))+geom_timeline()+mytheme+labs(fill="# deaths",size="Richter scale")                                                                          
#timeline plot of multiple countries
eqdata %>%
  ggplot(aes(x=DATE,y=COUNTRY,size=EQ_PRIMARY,fill=TOTAL_DEATHS/10000))+geom_timeline()+mytheme+labs(fill="# deaths",size="Richter scale")                                                                          
#timepline plot with location name of earthquakes
eqdata %>%
  filter(COUNTRY=="USA") %>%
  ggplot(aes(x=DATE,size=EQ_PRIMARY,fill=TOTAL_DEATHS/10000))+geom_timeline()+mytheme+labs(fill="# deaths",size="Richter scale")+geom_timeline_label(aes(label=LOCATION_NAME,n_max=8))                          
#interactive map annotated with date of earthquake
eqdata %>%
    filter(COUNTRY=="JAPAN") %>%
      eq_map(annot_col = "DATE")
#interactive map annotated with date of earthquake
eqdata %>%
    filter(COUNTRY=="INDONESIA") %>%
      eq_create_label() %>%
      eq_map(annot_col = "popup_text")


hsm-stephanie/earthquake documentation built on April 30, 2020, 12:44 p.m.