knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(magrittr)
library(dplyr)
library(readr)
library(kableExtra)
library(msdr)

Table of Contents

1. Introduction {#intro}

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.

Example 1 {#example_1}

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()

Example 2 {#example_2}

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")


nandinigntr/MSDR documentation built on Jan. 1, 2021, 11:32 a.m.