-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
57 lines (43 loc) · 1.62 KB
/
README.Rmd
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
always_allow_html: yes
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Introduction to NOAAeq
[![Travis-CI Build Status](https://travis-ci.org/la-sch/NOAAeq.svg?branch=master)](https://travis-ci.org/la-sch/NOAAeq)
The `NOAAeq` package analyses data from the [Significant Earthquake Database](https://www.ngdc.noaa.gov/nndc/struts/form?t=101650&s=1&d=1) of the U.S. National Oceanographic and Atmospheric Administration (NOAA). This dataset contains information about 5,933 earthquakes over an approximately 4,000 year time span.
The package has 3 main functionalities:
* Data cleaning
* Timeline plots
* Interactive leaflet maps
## Timelines
Here is an example of a timeline plot for the USA, covering the recent period 2000-2017.
```{r setup, include=FALSE}
require("knitr")
require("NOAAeq")
require("magrittr")
opts_knit$set(root.dir = system.file("extdata", package = "NOAAeq"))
```
```{r data, include=FALSE}
data <- readr::read_delim(file = "earthquakes.tsv.gz", delim = "\t")
```
```{r timeline1, echo=TRUE, fig.width=7, fig.height=2}
data %>%
eq_clean_data() %>%
dplyr::filter(lubridate::year(DATE) %in% 2000:2017 & COUNTRY == "USA") %>%
ggplot(aes(x = DATE, size = EQ_PRIMARY, fill = TOTAL_DEATHS)) +
geom_timeline() +
theme_classic() +
theme(legend.position = "bottom") +
scale_size_continuous(name = "Richter scale value") +
scale_fill_continuous(name = "# deaths") +
guides(size = guide_legend(order = 1),
fill = guide_colourbar(order = 2))
```