eq_map: Interactive Earthquake Map

Description Usage Arguments Details Value See Also Examples

View source: R/leaflet_map.R

Description

eq_map creates an interactive leaflet map showing the location of earthquakes in the given quakes data set.

Usage

1
eq_map(data, annot_col = "DATE")

Arguments

data

The quakes data frame. For best results, you should filter to a single country or nearby countries, and preferably filter down to a relatively narrow date range (maybe several decades at most).

annot_col

The column to use for the popup annotation. You may use a single column; otherwise create a more useful label first by using the eq_create_label function.

Details

This function shows an interactive map of the location of the earthquakes in the given quakes data. The size of the circles are proportional to the magnitude of the earthquakes (in the EQ_PRIMARY) variable. The map is interactive, and when you click on a link, the popup shows the annotation as specified by the annot_col variable.

Value

Returns an interactive leaflet map.

See Also

eq_create_label to create a more useful popup annotation in the quakes data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(lubridate); library(dplyr)

## use 'DATE' as annotation
quakes <- eq_load_clean_data() %>%
 dplyr::filter(COUNTRY == 'JAPAN') %>%
 dplyr::filter(lubridate::year(DATE) >= 2000)

eq_map(quakes, annot_col = 'DATE')


## Create a popup_text variable and use that for the label
quakes <- eq_load_clean_data() %>%
 dplyr::filter(COUNTRY == 'JAPAN') %>%
 dplyr::filter(lubridate::year(DATE) >= 2000) %>%
 dplyr::mutate(popup_text = eq_create_label(.))
eq_map(quakes, annot_col = 'popup_text')

DYZI/Earthquake documentation built on May 7, 2019, 6:54 p.m.