eq_map_add_popup: Add a column with popup text to be displayed on the map

Description Usage Arguments Value Examples

View source: R/map_leaflet.R

Description

This function takes the dataset as an argument and creates an HTML label that can be used as the annotation text in the leaflet map. This function puts together a character string for each earthquake that shows the cleaned location (as cleaned by the eq_location_clean() function, the magnitude (EQ_PRIMARY), and the total number of deaths (TOTAL_DEATHS). If an earthquake is missing values for any of these, both the label and the value are skipped for that element of the tag.

Usage

1

Arguments

eq_data

a dataframe with NOAA's earthquake data.

Value

The original dataframe with a new column called popup_text.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(dplyr)

# load data
filename <- system.file("extdata/earthquakes.tsv.gz", package = "quakeR")
raw_data <- readr::read_delim(filename, delim = "\t")

map_data <-
  raw_data %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO",
                lubridate::year(DATE) >= 2000) %>%
  eq_map_add_popup()

eq_map(map_data, annot_col = "popup_text")

vadimus202/quakeR documentation built on May 19, 2019, 1:47 a.m.