Description Usage Arguments Value Examples
View source: R/map_functions.R
The function eq_create_label
creates HTML labels for earthquakes
that can be used as annotation text in function eq_map
.
1 2 | eq_create_label(data, location = "LOCATION_NAME", magnitude = "EQ_PRIMARY",
total_deaths = "TOTAL_DEATHS")
|
data |
A NOAA data frame. |
location |
The column of the data frame depicting the location of earthquakes. |
magnitude |
The column of the data frame depicting the magnitude of earthquakes. |
total_deaths |
The column of the data frame depicitn the number of total deaths of earthquakes. |
A HTML label containing location, magnitude, and total deaths information of earthquakes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # import libraries
library(dplyr)
library(readr)
# set working directory
setwd(system.file("extdata", package = "noaa"))
# read and clean NOAA data
data <- readr::read_delim("signif.txt", "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "MEXICO", YEAR > 2000)
# create HTML labels
data <- data %>%
dplyr::mutate(html_label = eq_create_label(.))
# map and annotate NOAA data
eq_map(data, annot_col = "html_label")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.