eq_clean_data: Clean Earthquake Data

Description Usage Arguments Details Value Examples

Description

eq_clean_data takes a data frame of NOAA earthquake data and cleans it up for further analysis.

Usage

1

Arguments

data

A data frame of NOAA significant earthquake data, similar to what can be loaded with data(quakes). At a minimum, the data needs to have YEAR, MONTH, DAY, LATITUDE, LONGITUDE, DEATHS, TOTAL_DEATHS, and EQ_PRIMARY features.

Details

This function takes a data frame of NOAA earthquake data, which may be obtained from NOAA's Significant EarthQuake Database, or loaded into the envirnoment with data(quakes) (April 1, 2017 snapshot), and cleans it up for further analysis. In particular, it creates a DATE feature by combing the YEAR, MONTH, and DAY features, and makes sure the LATITUDE and LONGITUDE features are of type numeric. Also converts the DEATHS, TOTAL_DEATHS, and EQ_PRIMARY (Richter scale value) to type numeric.

For the DATE variable, note that R does not handle years before 1CE correctly (see documentation for as.Date). This function has attempted to make an approximation of those dates, but the user should handle with care. Also, for some events the month and day are not available, so those are approximated by January and 01, respectively.

Value

A tbl_df with the same supplied data, but with LATITUDE, LONGITUDE, DEATHS, TOTAL_DEATHS, and EQ_PRIMARY converted from character to numeric, and a new column DATE.

Examples

1
2
data(quakes)
quakes_clean <- eq_clean_data(quakes)

JazminCevallos/Package-Evaluation documentation built on May 27, 2019, 12:16 p.m.