eq_create_label: Create a function called eq_create_label() that takes the...

Description Usage Arguments Details Value Examples

View source: R/eq_map.R

Description

Create a function called eq_create_label() that takes the dataset as an argument and creates an HTML label that can be used as the annotation text in the leaflet map.

Usage

1
eq_create_label(mapdata)

Arguments

mapdata

A cleaned data frame with data obtained from NOAA website

Details

This function should put together a character string for each earthquake that will show the cleaned location (as cleaned by the eq_location_clean() function created in Module 1), 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.

Value

An HTML label that can be used as the annotation text in the leaflet map.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
readr::read_delim("signif.txt", delim = "\t") %>%
  eq_clean_data() %>%
  eq_location_clean() %>%
  dplyr::filter(COUNTRY == "CANADA" & lubridate::year(DATE) >= 2000) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

## End(Not run)

vnmath/SoftwareDevinR documentation built on July 6, 2020, 9:36 a.m.