Skip to contents

This function removes rows where the result value is not numeric to prepare a dataframe for quantitative analyses. Ideally, this function should be run after other data cleaning, QA/QC, and harmonization steps are completed using other TADA package functions, or manually. Specifically, . this function removes rows with "Text" and "NA - Not Available" in the TADA.ResultMeasureValueDataTypes.Flag column, or NA in the TADA.ResultMeasureValue column.

Usage

TADA_AutoFilter(.data)

Arguments

.data

TADA dataframe OR TADA sites dataframe

Value

.data with rows removed where result values are not quantitative (NA or text), or the results have other issues that are not dealt with elsewhere.

Details

This function also removes any columns not required for TADA workflow where all values are equal to NA.It also provides a warning message identifying any TADA required columns containing only NA values.

Examples

# Load example dataset:
data(Data_Nutrients_UT)

# Remove all:
TADA_filtered <- TADA_AutoFilter(Data_Nutrients_UT)
#> [1] "TADA_Autofilter: removing columns not required for TADA workflow if they contain only NAs."
#> [1] "The following column(s) were removed as they contained only NAs: ActivityDepthAltitudeReferencePointText, ActivityEndDate, ActivityEndTime.Time, ActivityEndTime.TimeZoneCode, ActivityEndDateTime, SampleAquifer, ResultWeightBasisText, ResultTemperatureBasisText, ResultParticleSizeBasisText, BinaryObjectFileName, BinaryObjectFileTypeCode, LabSamplePreparationUrl, timeZoneEnd and ProjectMonitoringLocationWeightingUrl."
#> [1] "TADA_Autofilter: checking required columns for non-NA values."
#> [1] "TADA Required column(s) SubjectTaxonomicName, SampleTissueAnatomyName, ResultDepthHeightMeasure.MeasureValue, TADA.ResultDepthHeightMeasure.MeasureValue, ResultDepthHeightMeasure.MeasureUnitCode, TADA.ResultDepthHeightMeasure.MeasureUnitCode, ResultDepthAltitudeReferencePointText, ResultTimeBasisText, StatisticalBaseCode, ResultFileUrl, ResultAnalyticalMethod.MethodUrl, DataQuality.PrecisionValue, DataQuality.BiasValue, DataQuality.ConfidenceIntervalValue, DataQuality.UpperConfidenceLimitValue, DataQuality.LowerConfidenceLimitValue, ProjectFileUrl, QAPPApprovalAgencyName and LocalAqfrName contain only NA values. This may impact other TADA functions."
#> [1] "Function removed 3381 results. These results are either text or NA and cannot be plotted or represent quality control activities (not routine samples or measurements)."