eq_create_label: Create HTML Label for Earthquakes

Description Usage Arguments Value Examples

View source: R/map_functions.R

Description

The function eq_create_label creates HTML labels for earthquakes that can be used as annotation text in function eq_map.

Usage

1
2
eq_create_label(data, location = "LOCATION_NAME", magnitude = "EQ_PRIMARY",
  total_deaths = "TOTAL_DEATHS")

Arguments

data

A NOAA data frame.

location

The column of the data frame depicting the location of earthquakes.

magnitude

The column of the data frame depicting the magnitude of earthquakes.

total_deaths

The column of the data frame depicitn the number of total deaths of earthquakes.

Value

A HTML label containing location, magnitude, and total deaths information of earthquakes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# import libraries
library(dplyr)
library(readr)
# set working directory
setwd(system.file("extdata", package = "noaa"))
# read and clean NOAA data
data <- readr::read_delim("signif.txt", "\t") %>%
   eq_clean_data() %>%
   dplyr::filter(COUNTRY == "MEXICO", YEAR > 2000)
# create HTML labels
data <- data %>%
   dplyr::mutate(html_label = eq_create_label(.))
# map and annotate NOAA data
eq_map(data, annot_col = "html_label")

kfull/noaa documentation built on May 25, 2019, 8:29 p.m.