eq_create_label: Creates R leaflet maps' popup text labels with the quake's...

Description Usage Arguments Warning Examples

Description

eq_create_label is useful to create the information that will be displayed in the text popup labels of the eq_map function.

Usage

1

Arguments

data

A tibble object with the earthquake traits (i.e., location name, magnitude, and total deaths).

Warning

In order to work, the following variables must exist in the data object: LOCATION_NAME (location name), EQ_PRIMARY (magnitude), and TOTAL_DEATHS (total deaths).

Examples

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

# Before showing the interactive map, we need to tidy the data up.
raw_data <- get_earthquake_data()
clean_data <- eq_clean_data(raw_data)
clean_data <- eq_location_clean(clean_data)

# Displays an R's leaflet map with the epicenters of the earthquakes that
# have occurred in Mexico as of 2000.  The interactive map has popup text
# labels with the location, magnitude, and total deaths.
clean_data %>%
  dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

Cesar-Urteaga/rnoaa documentation built on May 10, 2019, 5:16 a.m.