eq_map: Show Earthquakes on a map with annotations

Description Usage Arguments Value See Also Examples

View source: R/eq_map.R

Description

eq_map takes a data.frame with NOAA earthquake data, and plots those on an interactive map, along with annotations. In addition to NOAA data, eq_map also takes a parameter indicating which data.frame column to use for marker, pop-up annotations.

eq_map expects to find epicenter lattiude, longitude and earthquake magnitude in the LATTITUDE, LONGITUDE and EQ_PRIMARY columns respectively.

Usage

1
eq_map(data, annot_col)

Arguments

data

is a data.frame containing earthquake data filtered to show quakes in an area of interest.

annot_col

is a string which is the data.frame column name carrying annotations for marker pop-ups. The annotation may be plain text or HTML.

Value

eq_map returns a leaflet map object,

See Also

leaflet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(quake)
library(readr)
library(dplyr)
library(lubridate)

data_file_name <- system.file("extdata", "earthquakes.tsv.gz", package = "quake")

read_delim(data_file_name, delim = "\t") %>%
  eq_clean_data()                                       %>%
  filter(COUNTRY == "MEXICO" & year(date) >= 2000)      %>%
  mutate(popup_text = eq_create_label(.))               %>%
  eq_map(annot_col = "popup_text")

RussellPolitzky/quake documentation built on May 23, 2019, 10:35 p.m.