eq_create_label: Pop-up text for earthquakes

Description Usage Arguments Value Examples

Description

The function adds more interesting pop-ups for the interactive map created with the eq_map() function. The function takes the dataset as an argument and creates an HTML label that can be used as the annotation text in the leaflet map. The function should put together a character string for each earthquake that will show the cleaned location, the magnitude (EQ_PRIMARY), and the total number of deaths (TOTAL_DEATHS), with boldface labels for each (“Location”, “Total deaths”, and “Magnitude”). If an earthquake is missing values for any of these, both the label and the value should be skipped for that element of the tag.

Usage

1

Arguments

frame

The earthquake data frame. See the documentaton in the data part. A cleaned version should be used, cleaning: 'eq_clean_data()'.

Value

a HTML string containing the 3 fields.

Examples

1
2
3
4
5
earthquakes %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(date) >= 2000) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

cogitoergoread/noaa documentation built on May 20, 2019, 1:28 p.m.