eq_clean_data: Cleaning a NOAA (earthquake) file

Description Usage Arguments Details Value Note Examples

Description

The 'eq_clean_data' function returns a cleaned NOAA data frame

Usage

1

Arguments

data

- A delimited file that is read in by the 'read_delim' function

Details

The eq_clean_data function correct the data type of the columns YEAR, MONTH, DAY, LATITUDE, LONGITUDE, DEATHS and EQ_PRIMARY. The columns YEAR, MONTH and DAY are gathered to form a date (an as.Date object). The missing dates are filtered out. The magnitude of the earthquakes are rounded up to 2, 4, 6, 8 and 10. The locations in the column LOCATION_NAME is extracted and adjusted to title case. The column COUNTRY is alsp adjusted to title case with the eq_location_clean fucntion.

Value

A cleaned NOAA data frame

Note

error - When the column names do not include YEAR, MONTH, DAY, LATITUDE, LONGITUDE, DEATHS, EQ_PRIMARY, LOCATION_NAME and COUNTRY, an error will be given.

Examples

1
2
3
4
5
6
## Not run: 
file = "inst/extdata/earthquakes.tsv.gz"
file <- readr::read_delim(file, delim = "\t")
file_cleaned <- eq_clean_data(file)

## End(Not run)

jennychungpy/earthquakes documentation built on May 12, 2019, 2:01 p.m.