eq_create_label: Earthquake labels

Description Usage Arguments Details Value Examples

View source: R/map.R

Description

Create labels for earthquake data to be included in leaflet maps

Usage

1

Arguments

data

NOAA earthquake data in a clean dataframe (after a call to eq_clean_data)

Details

It 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 will show the cleaned location (as cleaned by the eq_location_clean() function), 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

A character vector with the labels

Examples

1
2
3
4
5
6
library(dplyr)
library(lubridate)
earthquake_data %>%
  filter(COUNTRY == "MEXICO" & year(DATE) >= 2000) %>%
  mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

raggaraluz/mastering_r_capstone documentation built on May 29, 2019, 6:53 p.m.