eq_create_label: Creates popup text for markers.

Description Usage Arguments Value Examples

View source: R/eq_create_label.R

Description

This function generates HTML formatted text to be used in popups for map markers.

Usage

1
eq_create_label(eq_data_clean = NULL)

Arguments

eq_data_clean

The clean earthquake data in a tbl_df object.

Value

This function returns a character vector containing popup text to be used in a leaflet visualization.

Examples

 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)

raggichr/earthquakes documentation built on June 25, 2020, 5:45 p.m.