Skip to contents

This function evaluates the data submitted under the "QAPPApprovedIndicator" column to determine if it has an approved Quality Assurance Project Plan (QAPP). Organizations use this field to indicate approval status, where 'Y' denotes approval and 'N' denotes non-approval. The function provides flexibility through three boolean arguments: clean, cleanNA, and flaggedonly, which control the filtering behavior of the data.

Usage

TADA_FindQAPPApproval(
  .data,
  clean = FALSE,
  cleanNA = FALSE,
  flaggedonly = FALSE
)

Arguments

.data

A dataframe containing the QAPP data.

clean

Logical. If TRUE, removes rows where QAPPApprovedIndicator equals 'N'. Default is FALSE.

cleanNA

Logical. If TRUE, removes rows where QAPPApprovedIndicator is NA. Default is FALSE.

flaggedonly

Logical. If TRUE, filters out rows where QAPPApprovedIndicator equals 'Y'. Default is FALSE.

Value

A filtered dataframe based on the combination of input parameters:

  • clean = TRUE, cleanNA = FALSE, flaggedonly = FALSE: Returns rows where QAPPApprovedIndicator is 'Y' or NA.

  • clean = TRUE, cleanNA = TRUE, flaggedonly = FALSE: Returns rows where QAPPApprovedIndicator is 'Y'.

  • clean = FALSE, cleanNA = TRUE, flaggedonly = FALSE: Returns rows where QAPPApprovedIndicator is 'Y' or 'N'.

  • clean = FALSE, cleanNA = FALSE, flaggedonly = FALSE: Returns the original dataframe without changes.

  • clean = TRUE, cleanNA = TRUE, flaggedonly = TRUE: Returns an error message.

  • clean = TRUE, cleanNA = FALSE, flaggedonly = TRUE: Returns rows where QAPPApprovedIndicator is NA.

  • clean = FALSE, cleanNA = TRUE, flaggedonly = TRUE: Returns rows where QAPPApprovedIndicator is 'N'.

  • clean = FALSE, cleanNA = FALSE, flaggedonly = TRUE: Returns rows where QAPPApprovedIndicator is 'N' or NA.

Details

The function operates based on the following default settings:

  • clean = TRUE: Removes rows where QAPPApprovedIndicator equals 'N'.

  • cleanNA = FALSE: Retains rows with QAPPApprovedIndicator as NA.

  • flaggedonly = FALSE: Flags but does not remove rows with QAPPApprovedIndicator as 'N'.

Users can adjust these settings to tailor the output:

  • Set cleanNA = TRUE to remove rows with NA values.

  • Set flaggedonly = TRUE to filter out rows where QAPPApprovedIndicator equals 'Y'.

Note: The QAPPApprovedIndicator field is optional and often left blank (NA), even if the data is associated with a QAPP. Most organizations collecting monitoring data using 106 funding are required to have an EPA-approved QAPP, hence most data should have an approved QAPP even if submitted as NA.

Examples

# Load example dataset:
data(Data_Nutrients_UT)

# Show data where the QAPPApprovedIndicator equals "Y" or "NA":
QAPPapproved_clean <- TADA_FindQAPPApproval(Data_Nutrients_UT)
#> [1] "Data is flagged but not removed because clean and cleanNA were FALSE"

# Show only data where the QAPPApprovedIndicator equals "Y":
QAPPapproved_cleanNAs <- TADA_FindQAPPApproval(Data_Nutrients_UT, cleanNA = TRUE)

# Show data where the QAPPApprovedIndicator equals "N" or "NA":
QAPPIndicator_N_NA <- TADA_FindQAPPApproval(Data_Nutrients_UT,
  clean = FALSE,
  cleanNA = FALSE, flaggedonly = TRUE
)

# Show data where the QAPPApprovedIndicator equals "N":
QAPPIndicator_N <- TADA_FindQAPPApproval(Data_Nutrients_UT,
  clean = FALSE,
  cleanNA = TRUE, flaggedonly = TRUE
)

# Note: When clean = FALSE, cleanNA = FALSE, and flaggedonly = FALSE, no data is removed
# Note: When clean = TRUE, cleanNA = TRUE, and flaggedonly = TRUE, an error message is returned