Coursera Capstone Package Description

This package specializes in visualizing a set of earthquake date from the National Centers for Environmental Information (NOAA). It will provide both a visualization of time as well as location.

It provides two custom Geom_*'s that will allow the user to utilize ggplot2, two functions to create an interactive map widget, and two functions to clean the raw NOAA data set, which is comes with the package and has already been cleaned.

The 2 GEOM_*'s

geom_timeline

Will create the essential layer

geom_timeline_label

Will create the annotation layer

The Widget's functions

eq_create_label

Creates the label for the annotation of the map widget. The label will display location, magnitude, and number of deaths, if applicable.

eq_map

This will create the interactive map widget.

The two data cleaning functions

eq_clean_data

Creates the Date Column

eq_location_clean

Removes country in the location name field.

Examples

ggplot(noaa[noaa$COUNTRY=="CHINA", ] , aes(DATE, COUNTRY, size=EQ_MAG_MW, colour=DEATHS)) + geom_timeline(xmin="-1000-01-01", xmax="1000-01-01") + theme_classic() + theme(legend.position="bottom", axis.line.y=element_blank()) + labs(y=NULL) +

geom_timeline_label(aes(label=LOCATION_NAME), n_max=10,xmin="-1000-01-01", xmax="1000-01-01")

noaa %>% eq_clean_data() %>% eq_location_clean() %>% dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>% eq_map(annot_col = "DATE")

noaa %>% eq_clean_data() %>% eq_location_clean() %>% dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>% dplyr::mutate(popup_text = eq_create_label(.)) %>% eq_map(annot_col = "popup_text")



JunlueZhao/CourseraCaptsoneWeek3 documentation built on May 20, 2019, 5:40 p.m.