library(earthquake)
# Load, clean and filter data.
data("earthquakes")
earthquakes <- earthquakes %>%
eq_clean_data() %>%
eq_location_clean() %>%
eq_select_data() %>%
eq_filter_data(countries = c("Mexico"),
minimum_date = "1980-01-01",
maximum_date = "2018-12-31")
context("eq_map")
test_that("Leaflet map", {
g <- earthquakes %>%
dplyr::mutate(POPUP_TEXT = eq_create_label(.)) %>%
eq_map(annot_col = "POPUP_TEXT")
# Plot is a leaflet map
expect_equal(attributes(g)$package, "leaflet")
})
context("eq_create_label")
test_that("Leaflet map labels", {
g <- earthquakes %>%
dplyr::mutate(POPUP_TEXT = eq_create_label(.))
# html label is built correctly
expect_equal(g$POPUP_TEXT[1], "<b>Location: </b>Nw</br><b>Magnitude: </b>6.4</br><b>Total Deaths: </b>1</br>")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.