This is an overview of an R package that contains functions to read in, clean, and visuaize earthquakes data available from the NOAA dataset.

library(software.dev.capstone)
library(readr)
library(tidyr)
library(dplyr)
library(lubridate)
library(stringr)
library(ggplot2)
library(grid)
library(leaflet)

R Capstone Package Content

The R Capstone package is composed of the following functions:

eq_clean_data: reads in and cleans the earthquakes dataset, including creating a date variable and making latitude/longitude numeric eq_location_clean: specifically cleans the location_name variable from the earthquake dataset geom_timeline: visualizes a timeline of the earthquakes in the dataset geom_timeline_label: creates labels that appear on the timeline of earthquakes visualization eq_map: creates a map of the earthquakes in the dataset eq_create_label: creates pop-up labels that appear on the map of earthquakes

Required Packages

The following packages are loaded and required by the package.

library(software.dev.capstone)
library(readr)
library(tidyr)
library(dplyr)
library(lubridate)
library(stringr)
library(ggplot2)
library(grid)
library(leaflet)

Data Files

Data files can be found at

list.files(system.file("signif.txt", package = "software.dev.capstone"))

eq_clean_data

df <- eq_clean_data("signif.txt")

eq_location_clean

df <- eq_location_clean(intermediate_data)

geom_timeline

ggplot() + geom_timeline(aes(x = DATE, y = COUNTRY, color = TOTAL_DEATHS)

geom_timeline_label

ggplot() + geom_timeline(aes(x = DATE, y = COUNTRY, color = TOTAL_DEATHS) + geom_timeline_label(aes(x = DATE, y = COUNTRY, magnitude = EQ_PRIMARY, label = LOCATION_NAME, n_max = 5))

eq_map

readr::read_delim("earthquakes.tsv.gz", delim = "\t") %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
  eq_map(annot_col = "DATE")

eq_create_label

readr::read_delim("earthquakes.tsv.gz", delim = "\t") %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")


AESpe/R_capstone_final documentation built on Oct. 16, 2020, 12:37 a.m.