Description Usage Arguments Warning Examples
eq_create_label
is useful to create the information that will be
displayed in the text popup labels of the eq_map
function.
1 |
data |
A tibble object with the earthquake traits (i.e., location name, magnitude, and total deaths). |
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).
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.