Skip to contents

With default settings (clean = FALSE), this function creates a TADA.UseForAnalysis.Flag column which flags any data that are NOT surface water results for removal (TADA.UseForAnalysis.Flag = "No") and flags surface water results for use in analysis (TADA.UseForAnalysis.Flag = "Yes"). If desired, a user can change the function input to clean = TRUE, and then the function will filter the data frame to remove rows that are not going to be used in analyses, and retain only the media types selected by the user.Setting clean = TRUE, means that all results not flagged for use in the analysis workflow will be removed and the TADA.UseForAnalysis.Flag column will not be added.

Usage

TADA_AnalysisDataFilter(
  .data,
  clean = FALSE,
  surface_water = TRUE,
  ground_water = FALSE,
  sediment = FALSE
)

Arguments

.data

A TADA profile object

clean

Boolean argument; TRUE removes all results not flagged for use in analysis workflow. TADA.UseForAnalysis.Flag column displaying the media type (as determined by this function) and "Yes"/"No" will be added when clean = FALSE. Results flagged "Yes" are identified as usable for further analysis. Default = FALSE.

surface_water

Boolean argument; specifies whether surface water results should be flagged or removed in the returned data frame. Default is surface_water = TRUE, surface water results are identified as usable for analysis.

ground_water

Boolean argument; specifies whether ground water results should be flagged or removed in the returned data frame. Default is ground_water = FALSE, ground water results are identified as not usable for analysis.

sediment

Boolean argument; specifies whether sediment results should be flagged or removed in the returned data frame. Default is sediment = FALSE, sediment results are identified as not usable for analysis.

Value

If clean = TRUE, returns the data frame with only the media types selected as usable (set to TRUE in function input) by the user. If clean = FALSE, returns the data frame and an additional column, TADA.UseForAnalysis.Flag, indicating the media type (as determined by this function) and which results should be included or excluded from assessments based on user input.

Details

It uses ActivityMediaSubdivisionName, AquiferName, LocalAqfrName, ConstructionDateText, WellDepthMeasure.MeasureValue, WellDepthMeasure.MeasureUnitCode, WellHoleDepthMeasure.MeasureValue, and WellHoleDepthMeasure.MeasureUnitCode to identify groundwater samples. Users can select whether sediment, groundwater and/or surface water should be included. An additional column, TADA.UseForAnalysis.Flag, specifies whether each row should be included in the analysis workflow and why. Setting clean = TRUE, means that all results not flagged for use in the analysis workflow will be removed and the TADA.UseForAnalysis.Flag column will not be added.

Examples

data(Data_6Tribes_5y_Harmonized)
# Returns data with ONLY surface water results retained and no TADA.UseForAnalysis.Flag column
Data_6Tribes_Assessment1 <- TADA_AnalysisDataFilter(Data_6Tribes_5y_Harmonized, clean = TRUE, 
surface_water = TRUE, ground_water = FALSE, sediment = FALSE)
#> [1] "TADA_AnalysisDataFilter: Identifying groundwater results."
#> [1] "TADA_AnalysisDataFilter: Flagging surface water results to include in assessments."
#> [1] "TADA_AnalysisDataFilter: Flagging groundwater results to exclude from assessments."
#> [1] "TADA_AnalysisDataFilter: Flagging sediment results to exclude from assessments."
#> [1] "TADA_AnalysisDataFilter: Removing results flagged for exclusion from assessments."

# Returns data frame with ONLY surface water results identified as usable and adds 
# TADA.UseForAnalysis.Flag column.
Data_6Tribes_Assessment2 <- TADA_AnalysisDataFilter(Data_6Tribes_5y_Harmonized, clean = FALSE, 
surface_water = TRUE, ground_water = FALSE, sediment = FALSE)
#> [1] "TADA_AnalysisDataFilter: Identifying groundwater results."
#> [1] "TADA_AnalysisDataFilter: Flagging surface water results to include in assessments."
#> [1] "TADA_AnalysisDataFilter: Flagging groundwater results to exclude from assessments."
#> [1] "TADA_AnalysisDataFilter: Flagging sediment results to exclude from assessments."
#> [1] "TADA_AnalysisDataFilter: Returning all results with TADA.UseForAnalysis.Flag column indicating if result should be used for assessments."
unique(Data_6Tribes_Assessment2$TADA.UseForAnalysis.Flag)
#> [1] "No - BIOLOGICAL"     "Yes - SURFACE WATER" "No - GROUNDWATER"   
#> [4] "No - AIR"