Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
44 changes: 0 additions & 44 deletions R/ResultFlagsDependent.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,47 +267,3 @@ DepthProfileData <- function(.data, convert = FALSE){
}
}




#' MediaNotWater
#'
#' **Placeholder text for function description
#'
#' @param data TADA dataset
#' @param clean Clean argument indicates whether flag columns should be appended
#' to the data (clean = FALSE), or flagged data is transformed/filtered from the
#' dataset and no columns are appended (clean = TRUE).
#'
#' @return Full TADA dataset with flags or data removed
#' @export

MediaNotWater <- function(data, clean = TRUE){

field.names <- colnames(data)

if(TADAprofileCheck(data) == FALSE) {
stop("The dataframe does not contain the required fields to use TADA.
Use either the full physical/chemical profile downloaded from WQP or
download the TADA profile template available on the EPA TADA webpage.")
}

if(TADAprofileCheck(data) == TRUE) {

if(clean == TRUE) {
# Remove all data where media name does NOT equal WATER (ignore punctuation)
cleandata <- dplyr::filter(data, ActivityMediaName == "Water")

return(cleandata)
}

if(clean == FALSE) {
# NEED TO EDIT TO ADD FLAGS, currently removes other water Water
flagdata <- dplyr::filter(data, ActivityMediaName == "water")

return(flagdata)
} else {
stop("'clean' argument must be Boolean (TRUE or FALSE)")
}
}
}
44 changes: 44 additions & 0 deletions R/ResultFlagsIndependent.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,47 @@ AggregatedContinuousData <- function(.data, clean = FALSE){
}
}
}



#' MediaNotWater
#'
#' **Placeholder text for function description
#'
#' @param data TADA dataset
#' @param clean Clean argument indicates whether flag columns should be appended
#' to the data (clean = FALSE), or flagged data is transformed/filtered from the
#' dataset and no columns are appended (clean = TRUE).
#'
#' @return Full TADA dataset with flags or data removed
#' @export

MediaNotWater <- function(data, clean = TRUE){

field.names <- colnames(data)

if(TADAprofileCheck(data) == FALSE) {
stop("The dataframe does not contain the required fields to use TADA.
Use either the full physical/chemical profile downloaded from WQP or
download the TADA profile template available on the EPA TADA webpage.")
}

if(TADAprofileCheck(data) == TRUE) {

if(clean == TRUE) {
# Remove all data where media name does NOT equal WATER (ignore punctuation)
cleandata <- dplyr::filter(data, ActivityMediaName == "Water")

return(cleandata)
}

if(clean == FALSE) {
# NEED TO EDIT TO ADD FLAGS, currently removes other water Water
flagdata <- dplyr::filter(data, ActivityMediaName == "water")

return(flagdata)
} else {
stop("'clean' argument must be Boolean (TRUE or FALSE)")
}
}
}