eq_clean_data: Clean Earthquake Data

Description Usage Arguments Value Examples

View source: R/eq_cleaning.R

Description

eq_clean_data performs a series of edits to clean the earthquake data. It converts the SECOND variable to a numeric type and rounds the decimal to the nearest whole number, replaces missing values in the MONTH and DAY variables with '1' and missing values in the HOUR, MINUTE and SECOND variables with '0'. It uses the YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND variables to create a new DATE variable that contains the date of an event. It converts the LATITUDE and LONGITUDE variables to a numeric type, renames the I_D variable to ID, changes the FLAG_TSUNAMI variable to a logical value, and changes the EQ_PRIMARY variable from a character to a numeric type. Finally, it filters the dataset to remove observations with missing values in the DATE, EQ_PRIMARY and TOTAL_DEATHS variables.

Usage

1

Arguments

df

A data frame containing the earthquake data.

Value

A data frame containing the cleaned earthquake data. If an error or warning occurs, a message will be printed to the console and the function will return NULL.

Examples

1
2
3
4
## Not run: 
earthquakes <- eq_clean_data(earthquakes)

## End(Not run)

dtminnick/earthquake documentation built on Nov. 4, 2019, 11:04 a.m.