eq_time: Creates a timeline visualization for NOAA earthquake data.

Description Usage Arguments Value Examples

Description

This function generates a timeline visualization for the NOAA earthquake data. The data should be subsetted in order to create an understandable visualization. There are several ways to call the function so that different visualizations are generated. The function is a wrapper function and calls geom_timeline and if a label is specified, also calls the geom_timeline_label function.

Usage

1
2
eq_time(eq_clean = NULL, y = NULL, size = NULL, color = NULL,
  alpha = 0.4, timeline_label = FALSE, n_max = 5)

Arguments

eq_clean

The clean earthquake data in a tbl_df object.

y

Optional parameter for COUNTRY; specifes a separate timeline for each country.

size

Optional parameter for earthquake magnitude (EQ_PRIMARY); specifies a point size based on magnitude.

color

Optional parameter for number of deaths (DEATHS); specifies a point color based on deaths.

alpha

Optional parameter for point transparency.

timeline_label

Optional parameter to select timeline labeling.

n_max

Optional parameter to specify number of earthquakes to be labeled. The earthquakes with n_max highest magnitudes will be labeled.

Value

This function returns a timeline visualization for a subset of the earthquake data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 

filename<-system.file("extdata","earthquakes_data.txt.gz",package="earthquakesViz")

readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "USA" & lubridate::year(DATE) >= 2000) %>%
eq_time(size="EQ_PRIMARY",color="DEATHS")

readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "USA" & lubridate::year(DATE) >= 2000) %>%
eq_time(size="EQ_PRIMARY",color="DEATHS",alpha=0.5,timeline_label=TRUE,n_max=8)

readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY=="USA" | COUNTRY=="CHINA") & lubridate::year(DATE) >= 2000) %>%
eq_time(y="COUNTRY",color="DEATHS",alpha=0.5)

readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY=="USA" | COUNTRY=="CHINA") & lubridate::year(DATE) >= 2000) %>%
eq_time(y="COUNTRY",color="DEATHS",alpha=0.5,timeline_label=TRUE)


## End(Not run)

leigitcode/earthquakesViz documentation built on May 7, 2019, 11:14 a.m.