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.
Arguments
- .data
A dataframe containing the QAPP data.
- clean
Logical. If
TRUE
, removes rows whereQAPPApprovedIndicator
equals 'N'. Default isFALSE
.- cleanNA
Logical. If
TRUE
, removes rows whereQAPPApprovedIndicator
is NA. Default isFALSE
.- flaggedonly
Logical. If
TRUE
, filters out rows whereQAPPApprovedIndicator
equals 'Y'. Default isFALSE
.
Value
A filtered dataframe based on the combination of input parameters:
clean = TRUE
,cleanNA = FALSE
,flaggedonly = FALSE
: Returns rows whereQAPPApprovedIndicator
is 'Y' or NA.clean = TRUE
,cleanNA = TRUE
,flaggedonly = FALSE
: Returns rows whereQAPPApprovedIndicator
is 'Y'.clean = FALSE
,cleanNA = TRUE
,flaggedonly = FALSE
: Returns rows whereQAPPApprovedIndicator
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 whereQAPPApprovedIndicator
is NA.clean = FALSE
,cleanNA = TRUE
,flaggedonly = TRUE
: Returns rows whereQAPPApprovedIndicator
is 'N'.clean = FALSE
,cleanNA = FALSE
,flaggedonly = TRUE
: Returns rows whereQAPPApprovedIndicator
is 'N' or NA.
Details
The function operates based on the following default settings:
clean = TRUE
: Removes rows whereQAPPApprovedIndicator
equals 'N'.cleanNA = FALSE
: Retains rows withQAPPApprovedIndicator
as NA.flaggedonly = FALSE
: Flags but does not remove rows withQAPPApprovedIndicator
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 whereQAPPApprovedIndicator
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