Skip to contents

Create A Two-Characteristic Scatterplot

Usage

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

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.

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_STD UNITS'. 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:
utils::data(Data_6Tribes_5y_Harmonized)
# Review monitoring location and result counts for each TADA.ComparableDataIdentifier
TADA_SummarizeColumn(Data_6Tribes_5y_Harmonized, col = "TADA.ComparableDataIdentifier")
#> # A tibble: 48 × 3
#>    TADA.ComparableDataIdentifier                       n_sites n_records
#>    <chr>                                                 <int>     <int>
#>  1 ALKALINITY, TOTAL_TOTAL_AS CACO3_PCU                      1         1
#>  2 ALKALINITY_TOTAL_AS CACO3_UG/L                           26        53
#>  3 AMMONIA_UNFILTERED_AS N_MG/L                             23        32
#>  4 AMMONIUM_UNFILTERED_AS N_MG/L                            17       214
#>  5 APPARENT COLOR_TOTAL_NONE_PCU                            23       161
#>  6 CONDITION CLASS (DISSOLVED OXYGEN (DO))_NONE_NONE_%      25       545
#>  7 COUNT_NONE_NONE_COUNT                                     3        41
#>  8 DEPTH, SECCHI DISK DEPTH_NONE_NONE_M                     88      1619
#>  9 DEPTH, SNOW COVER_NONE_NONE_IN                           45       146
#> 10 DISCHARGE, RIVER/STREAM_NONE_NONE_CFS                     1        30
#> # ℹ 38 more rows

# Create a single scatterplot with two specified groups from TADA.ComparableDataIdentifier
# These two have the most results in the example data
TADA_TwoCharacteristicScatterplot(Data_6Tribes_5y_Harmonized,
  id_cols = "TADA.ComparableDataIdentifier",
  groups = c(
    "TEMPERATURE_NONE_NONE_DEG C",
    "PH_NONE_NONE_NONE"
  )
)