Description Usage Arguments Value Note Examples
The function eq_map()
that takes an argument data containing
the filtered data frame with earthquakes to visualize. The function maps the
epicenters (LATITUDE/LONGITUDE
) and annotates each point with in pop up window
containing annotation data stored in a column of the data frame.
The user should be able to choose which column is used for the annotation in
the pop-up with a function argument named annot_col
. Each earthquake
should be shown with a circle, and the radius of the circle should be
proportional to the earthquake's magnitude (EQ_PRIMARY
).
The Earthquakes will be mapped centered with their latitude and
longitude "epicenter". The epicenter is annotated based on an annot_col
which the user can specify. In addition, if the user specifies "popup_text"
then a call to eq_create_label generates the appropriate text for the popup.
1 |
eq_data_clean |
the clean earthquake data in a tbl_df object. |
annot_col |
a column name in the tbl_df object to be used for annotation. |
an interactive leaflet map.
If an invalid column name is provided, the function provides a warning and uses the LOCATION_NAME column as the annotation column.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## 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) %>%
eq_map(annot_col = "DATE")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.