## ---- message=FALSE------------------------------------------------------
eq_data <- readr::read_delim('signif.txt', delim = '\t')
dim(eq_data)
## ---- echo=FALSE, warning=FALSE------------------------------------------
library(magrittr)
library(EarthquakesNOAA)
## ------------------------------------------------------------------------
clean_eq_data <- eq_data %>%
eq_clean_data()
## ------------------------------------------------------------------------
clean_loc_data <- eq_data %>%
eq_location_clean()
## ------------------------------------------------------------------------
data.frame(LOC_BEFORE = head(eq_data$LOCATION_NAME),
LOC_AFTER = head(clean_loc_data$LOCATION_NAME))
## ---- fig.width=7, fig.height=4------------------------------------------
eq_data %>%
eq_clean_data() %>%
dplyr::filter(lubridate::year(DATE) > 2010 & COUNTRY %in% c('CHILE', 'USA')) %>%
ggplot2::ggplot(ggplot2::aes(x = DATE, y = COUNTRY,
colour = DEATHS, size = EQ_PRIMARY)) +
geom_timeline(alpha = 0.5) +
theme_timeline
## ---- fig.width=7, fig.height=5.5----------------------------------------
eq_data %>%
eq_clean_data() %>%
dplyr::filter(lubridate::year(DATE) > 2010 & COUNTRY %in% c('CHILE', 'USA')) %>%
eq_location_clean() %>%
ggplot2::ggplot(ggplot2::aes(x = DATE, y = COUNTRY,
colour = DEATHS, size = EQ_PRIMARY)) +
geom_timeline(alpha = 0.5) +
geom_timelinelabel(ggplot2::aes(label = LOCATION_NAME, n_max = 3)) +
theme_timeline
## ---- fig.width=7, fig.height=4------------------------------------------
eq_data %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == 'MEXICO' & lubridate::year(DATE) >= 2000) %>%
eq_map(annot_col = 'DATE')
## ---- fig.width=7, fig.height=4------------------------------------------
eq_data %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == 'MEXICO' & lubridate::year(DATE) >= 2000) %>%
dplyr::mutate(popup_text = eq_create_label(.)) %>%
eq_map(annot_col = 'popup_text')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.