diff --git a/R/Utilities.R b/R/Utilities.R index d799eebf..d08eae45 100644 --- a/R/Utilities.R +++ b/R/Utilities.R @@ -1,26 +1,3 @@ -#' Apply Conversions -#' -#' **placeholder text for function description -#' -#' @param .data TADA dataset -#' @param Include Conversions to execute (should input be a column name? Or -#' groups of columns, which have their own group ID? Where would we put this -#' group ID info, another reference table? within the function?) -#' @param Exclude ibid, but conversions to not execute -#' -#' @return Full TADA dataset with data conversions executed. Function defaults -#' to convert the following: (**note all columns/type of data included in -#' conversions). -#' Users can specify which conversions to exclude. -#' @export -#' - - -ApplyConversions <- function(.data, Include, Exclude){ - -} - - #' AutoFilter #' #' This function can be used to autofilter and simplify a WQP dataset. @@ -39,7 +16,6 @@ ApplyConversions <- function(.data, Include, Exclude){ #' @export - AutoFilter <- function(.data, clean = TRUE){ field.names <- colnames(.data) @@ -71,24 +47,6 @@ AutoFilter <- function(.data, clean = TRUE){ } -#' Filter -#' -#' @param .data TADA dataset -#' -#' @return Full TADA dataset with data removed -#' -#' @export - - -Filter <- function(.data){ - -# Remove all data where media name does NOT equal WATER (ignore punctuation) -dplyr::filter(.data, ActivityMediaName == "Water") - - return(.data) -} - - #' RemoveEmptyColumns #' #' @param .data TADA dataset diff --git a/R/sysdata.rda b/R/sysdata.rda index 1b37a8e1..47d93ff5 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/vignettes/testing.Rmd b/vignettes/testing.Rmd index e0556821..ba98bb07 100644 --- a/vignettes/testing.Rmd +++ b/vignettes/testing.Rmd @@ -16,8 +16,12 @@ knitr::opts_chunk$set( ) ``` +Load TADA library and update internal TADA package validation and reference tables ```{r setup} library(TADA) +UpdateWQXCharValRef() +#UpdateMeasureUnitRef() +#HarmonizationRefTable() ``` Read in WQP data using WQP web services directly @@ -43,12 +47,44 @@ original data filters, but it cannot be used to download the data. WQP query URL: https://www.waterqualitydata.us/#statecode=US%3A42&characteristicType=Nutrient&mimeType=csv&dataProfile=resultPhysChem&providers=NWIS&providers=STEWARDS&providers=STORET ```{r} +#get PA nutrient data TADAProfileRaw=readWQPwebservice("https://www.waterqualitydata.us/data/Result/search?statecode=US%3A42&characteristicType=Nutrient&mimeType=csv&zip=yes&dataProfile=resultPhysChem&providers=NWIS&providers=STEWARDS&providers=STORET") ``` +Clean raw data for TADA use case ```{r} +#autoclean +TADAProfileClean=AggregatedContinuousData(TADAProfileClean) +``` + +Run result flag functions and address flagged data +```{r} +#TADAProfileClean=UncommonAnalyticalMethodID(TADAProfileClean) +TADAProfileClean=PotentialDuplicateRowID(TADAProfileClean) +TADAProfileClean=AboveNationalWQXUpperThreshold(TADAProfileClean) +TADAProfileClean=BelowNationalWQXUpperThreshold(TADAProfileClean) +TADAProfileClean=QAPPapproved(TADAProfileClean) +TADAProfileClean=QAPPDocAvailable(TADAProfileClean) +TADAProfileClean=InvalidCoordinates(TADAProfileClean) +TADAProfileClean=InvalidFraction(TADAProfileClean) +TADAProfileClean=InvalidSpeciation(TADAProfileClean) +TADAProfileClean=InvalidResultUnit(TADAProfileClean) +``` + +Address result values with special characters +```{r} +MeasureValueSpecialCharacters +``` +Apply unit conversions +```{r} +DepthProfileData +WQXTargetUnits ``` +Transform Characteristic, Speciation, and Unit values to TADA Standards +```{r} +HarmonizeData +```