eq_clean_data: Clean the raw NOAA earthquake data

Description Usage Arguments Value Examples

View source: R/clean_data.R

Description

This function takes the raw NOAA data and cleans it as per the requirements from Coursera: 1) Creates a date column by uniting the year, month, day and converting it to the Date class. 2) The LATITUDE and LONGITUDE columns are converted to a numeric class. 3) A function eq_location_clean() is applied that cleans the LOCATION_NAME column. We have also cleared any years that are negative as these create issues with as.Date.

Usage

1
eq_clean_data(df_raw)

Arguments

df_raw

A dataframe of raw NOAA data

Value

Returns a cleaned dataframe

Examples

1
2
3
4
5
6
7
## Not run: 
  df <- load_data() %>% dplyr::filter(YEAR >= 0) %>%
       dplyr::mutate(date = get_date(DAY, MONTH, YEAR))
  print(class(df))
  head(df)

## End(Not run)

simongarisch/R-Capstone-NOAA documentation built on Dec. 23, 2017, 10:28 a.m.