Skip to contents

Create Boxplot(s)

Usage

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

Arguments

.data

TADA data frame containing the data downloaded from the WQP, where each row represents a unique data record. Data frame 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 data frame (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 data frame used to identify the unique groups to be plotted. Defaults to 'TADA.ComparableDataIdentifier'.

Value

A list of plotly boxplot figures showing the median, 25th percentile, 75th percentile, upper fence, lower fence, minimum, maximum, and data outliers for each unique data group.

Examples

# Create a single boxplot using defaults. The input dataframe in this example
# includes only one unique TADA.ComparableDataIdentifier:
# Load example data frame:
data(Data_6Tribes_5y_Harmonized)
# Filter data down to a single TADA.ComparableDataIdentifier
df <- dplyr::filter(Data_6Tribes_5y_Harmonized, TADA.ComparableDataIdentifier == "TOTAL PHOSPHORUS, MIXED FORMS_UNFILTERED_AS P_UG/L")
# Generate single boxplot
TADA_Boxplot(df, id_cols = "TADA.ComparableDataIdentifier")
# Create multiple boxplots with additional grouping columns and view the first # plot in list. In this example, we will group data in the input dataframe # by both the TADA.ComparableDataIdentifier and the OrganizationIdentifier Boxplots_TPbyOrg <- TADA_Boxplot(df, id_cols = c("TADA.ComparableDataIdentifier", "OrganizationIdentifier")) # This example generates 2 box plots. Boxplots_TPbyOrg[[1]]
Boxplots_TPbyOrg[[2]]
# Create multiple boxplots with additional grouping columns and view the first # plot in list. In this example, we will group data in the input dataframe # by both the TADA.ComparableDataIdentifier and the MonitoringLocationTypeName # (e.g. stream, reservoir, canal, etc.) # Load example data frame: data(Data_Nutrients_UT) Boxplot_output <- TADA_Boxplot(Data_Nutrients_UT, id_cols = c("TADA.ComparableDataIdentifier", "MonitoringLocationTypeName")) #> [1] "Plotting function removed 2569 results where TADA.ResultMeasureValue = NA. These results cannot be plotted." # This example generates 32 box plots. Boxplot_output[[2]]
Boxplot_output[[25]]
Boxplot_output[[30]]