Skip to contents

Create A Two-Characteristic Scatterplot

Usage

TADA_TwoCharacteristicScatterplot(
  .data,
  id_cols = "TADA.ComparableDataIdentifier",
  groups
)

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.

id_cols

The column in the dataset used to identify the unique groups to be plotted. Defaults to 'TADA.ComparableDataIdentifier', which should be sufficient for most TADA use cases of this function. This input is flexible, however, for the specific use case in the TADAShiny app where a user might create groups based on a concatenation of the comparable data identifier with other additional grouping variables (e.g. site type, site name, year, organization, etc.)

groups

A vector of two identifiers from the id_cols column. For example, if the id_cols is 'TADA.ComparableDataIdentifier', the groups could be 'DISSOLVED OXYGEN (DO)_NA_NA_UG/L' and 'PH_NA_NA_NA'. These groups will be specific to your dataset. If the id_cols is 'MonitoringLocationName', the groups could be 'Upper Red Lake: West' and 'Upper Red Lake: West-Central'.

Value

A single plotly scatterplot figure with one x-axis (Date/Time) and a left and right y-axis showing the units of the two characteristic groups plotted on the same figure area.

Examples

# Load example dataset:
data(Data_Nutrients_UT)
# Create a single scatterplot with two specified groups from TADA.ComparableDataIdentifier
TADA_TwoCharacteristicScatterplot(Data_Nutrients_UT, id_cols = "TADA.ComparableDataIdentifier", groups = c("AMMONIA_UNFILTERED_AS N_MG/L", "NITRATE_UNFILTERED_AS N_MG/L"))
# Load example dataset: data(Data_6Tribes_5y_Harmonized) # Filter the example data so it includes only one TADA.ComparableDataIdentifier df <- dplyr::filter(Data_6Tribes_5y_Harmonized, TADA.ComparableDataIdentifier == "TOTAL PHOSPHORUS, MIXED FORMS_UNFILTERED_AS P_MG/L") # Creates a scatterplot including the two specified sites in the same plot: TADA_TwoCharacteristicScatterplot(df, id_cols = "MonitoringLocationName", groups = c("Upper Red Lake: West", "Upper Red Lake: West-Central")) #> [1] "Note: TADA.ComparableDataIdentifier not found in id_cols argument and is highly recommended."