knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(magrittr) library(dplyr) library(readr) library(kableExtra) library(msdr)
This function compounds a new information to be displayed in a popup of Leaflet package. For this reason, the dataset should have LOCATION
, EQ_PRIMARY
and DATE
.
The next example only show the content of each popup of Leaflet map.
# Path to the raw data. raw_data_path <- system.file("extdata", "signif.txt", package = "msdr") # Loading the dataset of Earthquake. df <- readr::read_delim(file = raw_data_path, delim = '\t', col_names = TRUE, progress = FALSE, col_types = readr::cols()) # Display the informaiton of each popup. df %>% eq_create_label() %>% head() %>% kable()
This example shows the complete case of plotting a popup with Location, Magnitude and date.
# Display the informaiton of each popup. df %>% # Cleaninig the data. eq_clean_data() %>% # Creating new content. dplyr::mutate(popup_text = eq_create_label(.)) %>% # Plotting new content inside of popup. eq_map(annot_col = "popup_text")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.