Description Usage Arguments Value Examples
View source: R/eq_clean_data.R
The dataset is obtained from the U.S. National Oceanographic and Atmospheric Administration (NOAA) on significant earthquakes around the world. This dataset contains information about 5,933 earthquakes over an approximately 4,000 year time span.
The eq_clean_data()
function takes the raw NOAA data frame and
returns a clean data frame. The clean data frame should have the following:
A date column created by uniting the year, month, day and converting it to the Date class.
LATITUDE and LONGITUDE columns converted to numeric class.
In addition, a LOCATION_NAME column by stripping out the country name (including the colon) and converts names to title case (as opposed to all caps). This will be needed later for annotating visualizations.
1 | eq_clean_data(eq_raw)
|
eq_raw |
the raw NOAA earthquake dataset as a data frame that contains location names written in upper case. |
returns a clean data frame of the NOAA earthquake dataset.
1 2 3 4 5 6 7 8 9 | ## Not run:
filename <- system.file("extdata", "signif.txt", package = "earthquakes")
library(readr)
eq_data_raw <- readr::read_delim(file = filename, delim = "\t")
eq_data <- eq_clean_data(eq_raw = eq_data_raw)
head(eq_data_raw$LOCATION_NAME)
head(eq_data$LOCATION_NAME)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.