data-raw/ProcessData_AZ_ChemInfo.R

# Prepare data for example for AZ, Chem Info
#
# Erik.Leppo@tetratech.com
# 20180611
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# 0. Prep####
wd <- getwd() # assume is package directory
#library(devtools)

# 1. Get data and process#####
# 1.1. Import Data
myFile <- "AZChemInfoFinal.tab"
df <- read.delim(file.path(wd, "data-raw", "AZ", myFile))

# Modify Names to match existing code
df$Analyte <- df$StdParamName
# 20190227, comment out, 'Category' no longer in data file
#    already have GroupNum and GroupName
# df$GroupNum <- as.numeric(df$Category)
# df$GroupName <- df$Category
df <- df[df$UseInStressorID==1,]


# 1.2. Process Data
View(head(df))
# QC check
dim(df)
# structure
str(df)

##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2. Save as RDA for use in package####
#
data_ChemInfo <- df
usethis::use_data(data_ChemInfo, overwrite = TRUE)
leppott/CASTfxn documentation built on Sept. 6, 2019, 11:04 p.m.