eq_clean_data: Cleans the raw NOAA earthquake dataset.

Description Usage Arguments Value Examples

View source: R/eq_clean_data.R

Description

The dataset is obtained from the U.S. National Oceanographic and Atmospheric Administration (NOAA) on significant earthquakes around the world. This dataset contains information about 5,933 earthquakes over an approximately 4,000 year time span.

The eq_clean_data() function takes the raw NOAA data frame and returns a clean data frame. The clean data frame should have the following:

  1. A date column created by uniting the year, month, day and converting it to the Date class.

  2. LATITUDE and LONGITUDE columns converted to numeric class.

  3. In addition, a LOCATION_NAME column by stripping out the country name (including the colon) and converts names to title case (as opposed to all caps). This will be needed later for annotating visualizations.

Usage

1
eq_clean_data(eq_raw)

Arguments

eq_raw

the raw NOAA earthquake dataset as a data frame that contains location names written in upper case.

Value

returns a clean data frame of the NOAA earthquake dataset.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
filename <- system.file("extdata", "signif.txt", package = "earthquakes")
library(readr)
eq_data_raw <- readr::read_delim(file = filename, delim = "\t")
eq_data <- eq_clean_data(eq_raw = eq_data_raw)
head(eq_data_raw$LOCATION_NAME)
head(eq_data$LOCATION_NAME)

## End(Not run)

raggichr/earthquakes documentation built on June 25, 2020, 5:45 p.m.