eq_location_clean: Clean Location Values

Description Usage Arguments Details Value Examples

View source: R/eq_cleaning.R

Description

eq_location_clean formats the LOCATION_NAME variable by stripping out the country from the name and converting the text from uppercase to title case. For consistency, it also removes extra spaces from the text and formats the COUNTRY variable in the same way as the LOCATION_NAME variable.

Usage

1

Arguments

df

A data frame cotaining the earthquake data.

Details

eq_location_clean assumes the country appears in the LOCATION_NAME variable at the beginning of the text and is separated from the location by a colon. Given this pattern, the function uses a regular expression to find and remove the country from the beginning of the text.

Value

A data frame containing the earthquake data with reformatted COUNTRY and LOCATION_NAME variables. 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: 
df <- eq_location_clean(df)

## End(Not run)

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