Skip to contents

Function checks the validity of each characteristic-analytical method combination in the dataframe. When clean = TRUE, rows with invalid characteristic-analytical method combinations are removed. Default is clean = TRUE. When flaggedonly = TRUE, dataframe is filtered to show only invalid characteristic-analytical method combinations. Default is flaggedonly = FALSE.

Usage

TADA_FlagMethod(.data, clean = TRUE, flaggedonly = FALSE)

Arguments

.data

TADA dataframe

clean

Boolean argument; removes "Invalid" characteristic-analytical method combinations from the dataframe when clean = TRUE. Default is clean = TRUE.

flaggedonly

Boolean argument; filters dataframe to show only "Invalid" characteristic-analytical method combinations when flaggedonly = TRUE. Default is flaggedonly = FALSE.

Value

This function adds the TADA.AnalyticalMethod.Flag to a TADA dataframe. This column flags invalid CharacteristicName, ResultAnalyticalMethod/MethodIdentifier, and ResultAnalyticalMethod/MethodIdentifierContext combinations in your dataframe as either "Not Reviewed", "Invalid", or "Valid". When clean = FALSE and flaggedonly = TRUE, the dataframe is filtered to show only "Invalid" characteristic-analytical method combinations; the column TADA.AnalyticalMethod.Flag is still appended. When clean = TRUE and flaggedonly = FALSE, "Invalid" rows are removed from the dataframe and no column will be appended.

Details

The “Not Reviewed” value within "TADA.ResultAboveUpperThreshold.Flag" means that the EPA WQX team has not yet reviewed the combinations (see https://cdx.epa.gov/wqx/download/DomainValues/QAQCCharacteristicValidation.CSV). The WQX team plans to review and update these new combinations quarterly.

Examples

# Load example dataset
data(Data_NCTCShepherdstown_HUC12)

# Remove invalid characteristic-analytical method combinations from dataframe:
InvalidMethod_clean <- TADA_FlagMethod(Data_NCTCShepherdstown_HUC12, clean = TRUE)

# Flag, but do not remove, invalid characteristic-analytical method combinations
# in new column titled "TADA.AnalyticalMethod.Flag":
InvalidMethod_flags <- TADA_FlagMethod(Data_NCTCShepherdstown_HUC12, clean = FALSE)

# Show only invalid characteristic-analytical method combinations:
InvalidMethod_flaggedonly <- TADA_FlagMethod(Data_NCTCShepherdstown_HUC12, clean = FALSE, flaggedonly = TRUE)