The package 'masteringSoftwareDevelopmentinR' is used to clean, manipulate and visualize the NOAA dataset
To install the package, you must be having 'devtools' package.
library(masteringSoftwareDevelopmentinR)
library(masteringSoftwareDevelopmentinR) library(readr) library(ggplot2) library(readr) library(dplyr) library(magrittr)
use data(earthquakes) to load the data into the environment. If you want to visualize a data stored in your local system, use eq_load_data
function to load the tsv data (from the NOAA website) onto the environment.
data = masteringSoftwareDevelopmentinR::earthquakesdata cleanedData = eq_clean_data(data)
Columns required for the geom_time()
x = DATE
y = COUNTRY
color = TOTAL_DEATHS
size = EQ_PRIMARY
cleanedData %>% filter(COUNTRY %in% 'ITALY', Year >= 1000 & Year <= 2000) %>% ggplot(.,aes(x = DATE, y = COUNTRY, color = `Total Deaths`, size = Mag))+ geom_timeline()
The user could use eq_create_label to have a HTML formatted label, which would give addition information.
data %>% eq_clean_data(.) %>% dplyr::filter(COUNTRY == "ITALY" )%>% dplyr::mutate(popup_text = eq_create_label(.)) %>% eq_map(annot_col = "popup_text")
data %>% eq_clean_data() %>% dplyr::filter(lubridate::year(DATE) >= 1855) %>% eq_map(annot_col = "DATE")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.