Description Usage Arguments Details Value See Also Examples
Create an interactive map of historical earthquakes using the NOAA earthquake database included with this package. Earthquakes are plotted as circles with their radii proportional to the magnatude of the earthquake. Optionally, labels can be passed which will pop up when the earthquake is clicked on.
1 | eq_map(earthquake_data, annot_col)
|
earthquake_data |
A dataframe with earthquake location columns
|
annot_col |
The character name of the column in |
This function uses of the popular leaflet
package, which creates
interactive html maps within R
An html map object, to which further Leaflet objects can be added
leaflet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(data.table)
library(dplyr)
raw_noaa <- as.data.table(noaa_data)
## Plot earthquakes in Mexico with date labels in popup windows
raw_noaa %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
eq_map(annot_col = "DATE")
## Plot earthquakes in Mexico with nicely formated popup windows
raw_noaa %>%
eq_clean_data() %>%
eq_location_clean() %>%
dplyr::filter(COUNTRY == "MEXICO" & DATE >= as.Date("2000-01-01")) %>%
dplyr::mutate(popup_text = eq_create_label(.)) %>%
eq_map(annot_col = "popup_text")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.