Description Usage Arguments Value Examples
View source: R/eq_create_label.R
This function generates HTML formatted text to be used in popups for map markers.
1 | eq_create_label(eq_data_clean = NULL)
|
eq_data_clean |
The clean earthquake data in a tbl_df object. |
This function returns a character vector containing popup text to be used in a leaflet visualization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
filename <- system.file("extdata", "signif.txt", package = "earthquakes")
library(readr)
eq_data_raw <- readr::read_delim(file = filename, delim = "\t")
eq_data <- eq_clean_data(eq_raw = eq_data_raw)
library(dplyr)
library(lubridate)
library(leaflet)
eq_data %>%
filter(COUNTRY %in% "ITALY" &
lubridate::year(DATE) >= 2000) -> eq_data_sample
eq_data_sample %>%
eq_clean_data() %>%
filter(COUNTRY %in% "ITALY" & lubridate::year(DATE) >= 2000) %>%
mutate(popup_text = eq_create_label(.)) %>%
eq_map(annot_col = "popup_text")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.