knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The package Earthquakes.capstone.project
has been built to clean and display the earthquake data from NOAA.
The Package is divided into 3 sections:
The cleaning part of the package is composed 2+1 functions:
'eq_read_data' opens the dataset named 'signif.txt'. It doesn't need any argument.
'eq_clean_data' do the cleaning of the raw dataset opened by 'eq_read_data' function.
'eq_location_cleaning' cleans the location variable of the dataset. It is called by eq_clean_data function.
'geom_timeline' creates timeline chart of earthquakes.
'geom_timeline_label' adds labels to the created timeline chart of earthquakes by 'geom_timeline'.
'eq_map' creates interactive chart of earthquakes.
'eq_map_label' adds labels to the interactive chart of earthquakes.
library(dplyr) raw_data = Earthquakes.capstone.project::eq_read_data()
clean_data = Earthquakes.capstone.project::eq_clean_data(raw_data)
clean_data %>% filter(COUNTRY %in% c("HUNGARY", "SLOVAKIA", "CZECH REPUBLIC", "CROATIA", "POLAND"), YEAR >= 1500) %>% ggplot(aes(x = DATE, y = COUNTRY)) + geom_timeline()
clean_data %>% filter(COUNTRY %in% c("JAPAN"), YEAR >= 2000) %>% ggplot(aes(x = DATE)) + geom_timeline()+ geom_timeline_label(aes(label = LOCATION_NAME, size = EQ_PRIMARY, nmax = 2))
clean_data %>% dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>% eq_map(annot_col = "DATE")
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.