knitr::opts_chunk$set( collapse = TRUE, comment = "#>", options(warn=-1) )
library(magrittr) library(dplyr) library(readr) library(kableExtra) library(msdr) library(ggplot2)
I have decided to create a new theme because it is a good opportunity to doing it so I have used the default theme and I have changed some visuals. As you can see, I have made a great effort to make it be similar to the example posted in class notebooks.
Adding theme to a regular plotting of earthquake.
Without theme:
# Path to the raw data. raw_data_path <- system.file("extdata", "signif.txt", package = "msdr") # Loading the dataset of Earthquake. df <- readr::read_delim(file = raw_data_path, delim = '\t', col_names = TRUE, progress = FALSE, col_types = readr::cols()) # Cleaning the data and filtering. df %>% eq_clean_data() %>% filter(COUNTRY %in% 'USA', YEAR >= 1900 & YEAR <= 2000) %>% # Creating a ggplot object ggplot() + # Using the new Geom geom_timeline(aes(x = DATE, y = COUNTRY, size = EQ_PRIMARY, color = TOTAL_DEATHS)) -> earthquake_usa_1900_2000 # Plotting earthquake_usa_1900_2000
Adding theme:
# Adding theme. earthquake_usa_1900_2000 + theme_msdr()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.