Description Usage Arguments Value Examples
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.
1 |
frame |
The earthquake data frame. See the documentaton in the data part. A cleaned version should be used, cleaning: 'eq_clean_data()'. |
a HTML string containing the 3 fields.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.