eq_clean_data: Import and clean NOAA data for use in analytics and...

Description Usage Arguments Examples

Description

This function will be used to import and clean NOAA data for further analysis. While it is possible that this will be called by the usuer, it is more likely the case that this function will be used in future functions that produced a more valuable output than the cleaned data itself. As is common this function uses the tidyverse packages. Normally the author prefers the data.table package for speed, however, the NOAA set is very small and users will more likely be familiar with tidyverse syntax. See https://www.ngdc.noaa.gov/nndc/struts/results?&t=101650&s=225&d=225 for data defintions.NOAA data goes back in history thousands of years. For this reason their raw data contains negative and positive years, the sign indicating the B.C vs A.D respectively.

Usage

1
2
eq_clean_data(dataframe, file = NULL, dayfill = 1, monthfill = 7,
  delim = "\t", ...)

Arguments

dataframe

A data.frame of dirty NOAA data that has been read in already. This argument is ignored if the file argument is provided. File is the more compact method of cleaning data as it does the import directly.

file

A character for the file that contains the 'dirty' data. This requires the full path if not in the working director. If a vector is given multiple data sets will be produced.

dayfill

A number indicating day of the month to use for missing data. The missing data is common for old earthquakes for which data is not possible. The default is to pick the first of the month.

monthfill

A number indicating the month to use for missing data. The missing data is common for old earthquakes for which data is not possible. The default is to pick July; middle of the year.

delim

A character string, dictating how the dirty data file is delimited. This control is passed directly into the delim argument of readr::read_delim. Currently NOAA data is stored in tab delimited, hence the default equal to "\t". This paratmeter is really a future proofing if NOAA changes or if the user has internal data collection that intermediately copies the data into a different delimited format. Non delimited file types are not supported.

...

This can be used primarily to pass arguments to the support functions imported from other packages:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 

#for a file from NOAA, simply point machine to file and the data.frame will return
eq_clean_data(file="datafromnoaa.txt")

#if you have imported the data and just want it cleaned per the standard of this package
data<-read.delim("file.csv")

eq_clean_data(dataframe=data)


## End(Not run)

JJNewkirk/NOAAEQ documentation built on May 27, 2019, 1:12 p.m.