TADA_Histogram: Create Histogram(s)

View source: R/Figures.R

TADA_HistogramR Documentation

Create Histogram(s)

Description

Create Histogram(s)

Usage

TADA_Histogram(.data, id_cols = c("TADA.ComparableDataIdentifier"))

Arguments

.data

TADA dataframe containing the data downloaded from the WQP, where each row represents a unique data record. Dataframe must include the columns 'TADA.ComparableDataIdentifier', 'TADA.ResultMeasureValue', and 'TADA.ResultMeasure.MeasureUnitCode' to run this function. 'TADA.ComparableDataIdentifier' can be added to the data frame by running the function TADA_HarmonizeSynonyms(). The user can include additional grouping columns in the id_cols input. If more than one group exists in the dataframe (i.e. two or more unique comparable data identifiers), the function creates a list of plots, where each list element name is a unique group identifier.

id_cols

The column(S) in the dataframe used to identify the unique groups to be plotted. Defaults to 'TADA.ComparableDataIdentifier'.

Value

A list of plotly histogram figures showing the distribution of sample values for each data group.

Examples

# Load example dataframe:
data(Data_6Tribes_5y_Harmonized)

# Create a histogram for each comparable data group (TADA.ComparableDataIdentifier)
# in the input dataframe:
TADA_Histogram(Data_6Tribes_5y_Harmonized, id_cols = "TADA.ComparableDataIdentifier")

# Create a single histogram using defaults. The input dataframe in this example
# is filtered so it includes only one TADA.ComparableDataIdentifier
df <- dplyr::filter(
  Data_6Tribes_5y_Harmonized,
  TADA.ComparableDataIdentifier ==
    "TOTAL PHOSPHORUS, MIXED FORMS_UNFILTERED_AS P_UG/L"
)
TADA_Histogram(df, id_cols = "TADA.ComparableDataIdentifier")

# Create multiple histograms with additional grouping columns and view the first
# plot in list. In this example, we will group by both TADA.ComparableDataIdentifier
# and MonitoringLocationTypeName (e.g. stream, reservoir, canal, etc.)
# Load example dataframe:
data(Data_Nutrients_UT)
Histogram_output <- TADA_Histogram(Data_Nutrients_UT,
  id_cols = c(
    "TADA.ComparableDataIdentifier",
    "MonitoringLocationTypeName"
  )
)
# This example generates 32 histograms
Histogram_output[[10]]
Histogram_output[[25]]
Histogram_output[[30]]


USEPA/TADA documentation built on April 12, 2025, 1:47 p.m.