Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing vignette #81

Merged
merged 1 commit into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions R/Utilities.R
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -39,7 +16,6 @@ ApplyConversions <- function(.data, Include, Exclude){
#' @export



AutoFilter <- function(.data, clean = TRUE){

field.names <- colnames(.data)
Expand Down Expand Up @@ -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
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
36 changes: 36 additions & 0 deletions vignettes/testing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```