Load in the dataframe containing the earthquake data and clean the data using the helper functions

library(earthquakes)
library(magrittr)
library(dplyr)
library(ggplot2)
library(lubridate)

setwd("..") # sets wd at top level of package
df <- download_NOAA() %>%
  eq_read_raw_data() %>%
  eq_clean_data()

A timeline showing all of the earthquakes in the USA since 2000

rf<- df %>% dplyr::filter(COUNTRY == "USA" | COUNTRY == "CHINA")
ggplot(rf) +
  geom_timeline(aes(x = DATE, colour = TOTAL_DEATHS, size = EQ_PRIMARY), 
                alpha = 0.5, xmindate = 2000, xmaxdate = 2017) +
  theme_classic() +
  theme(legend.position = "bottom",
        axis.title.y = element_blank(), 
        axis.line.y = element_blank(), 
        axis.ticks.y = element_blank(),
        panel.grid.major.y = element_line(colour = "grey", size = 0.5)) +
  labs(size = "Richter scale value ", colour = "# deaths ")

A leaflet map showing all the earthquakes that have taken place in Mexico since the year 2000. Pop-up labels are the date of the earthquake.

df %>% 
  filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
  mutate(popup_text = eq_create_label(.)) %>% 
  eq_map(annot_col = "DATE")

A leaflet map showing all the earthquakes that have taken place in China since the year 1980. Pop-up labels give information about the earthquake such as magnitude, number of deaths, and location name

df %>% 
  filter(COUNTRY == "CHINA" & lubridate::year(DATE) >= 1990) %>%
  mutate(popup_text = eq_create_label(.)) %>% 
  eq_map(annot_col = "popup_text")


galen211/msdr-capstone documentation built on May 15, 2019, 1:40 p.m.