eq_map: Create an interactive map of historical earthquakes

Description Usage Arguments Details Value See Also Examples

Description

Create an interactive map of historical earthquakes using the NOAA earthquake database included with this package. Earthquakes are plotted as circles with their radii proportional to the magnatude of the earthquake. Optionally, labels can be passed which will pop up when the earthquake is clicked on.

Usage

1
eq_map(earthquake_data, annot_col)

Arguments

earthquake_data

A dataframe with earthquake location columns LATITUDE and LONGITUDE, and magnatude column EQ_PRIMARY. The included noaa_data dataframe is already correctly formateed, and is intended to be used with this function

annot_col

The character name of the column in data containing a character vector of optional popup text to be shown when an earthquake is clicked on.

Details

This function uses of the popular leaflet package, which creates interactive html maps within R

Value

An html map object, to which further Leaflet objects can be added

See Also

leaflet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(data.table)
library(dplyr)
raw_noaa <- as.data.table(noaa_data)
## Plot earthquakes in Mexico with date labels in popup windows
raw_noaa %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
  eq_map(annot_col = "DATE")
## Plot earthquakes in Mexico with nicely formated popup windows
raw_noaa %>%
  eq_clean_data() %>%
  eq_location_clean() %>%
  dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

marksendak/MsdrCapstoneMPS documentation built on May 23, 2019, 7:33 a.m.