eq_create_label: Build an html label for earthquakes

Description Usage Arguments Value See Also Examples

Description

Create a nicely formatted HTML label for use with eq_map showing Location, Magnatude, and Total Deaths. Missing values are skipped in the created label.

Usage

1
eq_create_label(earthquake_data)

Arguments

earthquake_data

A dataframe containing location names in column LOCATION_NAME, earthquake magnitude in column EQ_PRIMARY, and total deaths caused by the earthquake in column TOTAL_DEATHS. An example of a correctly formatted dataset is noaa_data, which is included in the package.

Value

A character vector of formatted html strings to label the popups in eq_map

See Also

eq_map, leaflet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(data.table)
library(dplyr)
raw_noaa <- as.data.table(noaa_data)
raw_noaa %>%
  eq_clean_data() %>%
  dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
  eq_map(annot_col = "DATE")
## Plot earthquakes in Mexico with nicely formated popup windows
raw_noaa %>%
  eq_clean_data() %>%
  eq_location_clean() %>%
  dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
  dplyr::mutate(popup_text = eq_create_label(.)) %>%
  eq_map(annot_col = "popup_text")

marksendak/MsdrCapstoneMPS documentation built on May 23, 2019, 7:33 a.m.