Description Usage Arguments Examples
eq_create_label() takes the dataset as an argument and creates an HTML label that can be used as the annotation text in the leaflet map. This function puts together a character string for each earthquake that will show the cleaned location (as cleaned by the eq_location_clean() function created in Module 1), 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 |
df |
- A dataframe of containing 3 columns LABELS,EQ_PRIMARY and DEATHS. |
1 2 3 4 | library(magrittr)
labels<-readr::read_delim(system.file("extdata", "signif.txt", package="Earthquake"), delim = "\t")
lables<-labels %>% eq_clean_data %>% eq_create_label
head(labels)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.