eq_create_label: Function to create popup_label text for interactive map

Description Usage Arguments Value Examples

View source: R/eq_create_label.R

Description

This function creates labels for an interactive map using three columns from a data.frame (the data variable). By default these are the "LOCATION" (the line_1 variable), "EQ_PRIMARY" (the line_2 variable) AND "TOTAL_DEATHS" (the line_3 variable) columns. It will omit all NA info from the label text, and returns a vector that can be used as popuptext column in the data.frame as label text in the eq_map function.

Usage

1
2
eq_create_label(data = NULL, line_1 = "LOCATION", line_2 = "EQ_PRIMARY",
  line_3 = "TOTAL_DEATHS")

Arguments

data

a data.frame containing columns named: "LOCATION" LOCATION info of earthquake events "EQ_PRIMARY" size of earthquake events on Richter scale "TOTAL_DEATHS" Total deaths info of earthquake events

line_1

the name of a column in data; by default "LOCATION"

line_2

the name of a column in data; by default "EQ_PRIMARY"

line_3

the name of a column in data; by default "TOTAL_DEATHS"

Value

character vector containing popup-text

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# assuming earthquake data is in the file earthquakes.tvs.gz in the wd
readr::read_delim("earthquakes.tsv.gz", delim = "\t") %>%
    eq_clean_data() %>%
    dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
    dplyr::mutate(popup_text = eq_create_label(.)) %>%
    eq_map(annot_col = "popup_text")#'

## End(Not run)

RMHoek/NOAAearthquakeAnalysis documentation built on May 14, 2019, 8:58 a.m.