Tidies water quality data downloaded from EMS database using the bcgov/rems package. It retains and renames required columns and sets the timezone to PST.

tidy_ems_data(
  x,
  cols = character(0),
  mdl_action = c("zero", "mdl", "half", "na", "none")
)

Arguments

x

The data to tidy.

cols

additional columns from the EMS data to retain specified as a character vector of column names that exist in the data. The dafault columns retained are:

  • "EMS_ID"

  • "MONITORING_LOCATION" (Renamed to "Station")

  • "COLLECTION_START" (Renamed to "DateTime")

  • "PARAMETER" (Renamed to "Variable")

  • "PARAMETER_CODE" (Renamed to "Code")

  • "RESULT" (Renamed to "Value")

  • "UNIT" (Renamed to "Units")

  • "METHOD_DETECTION_LIMIT" (Renamed to "DetectionLimit")

  • "RESULT_LETTER" (Renamed to "ResultLetter")

  • "SAMPLE_STATE"

  • "SAMPLE_CLASS"

  • "SAMPLE_DESCRIPTOR"

mdl_action

What to do with values below the detection limit. Options are "zero" (set the value to 0; the default), #' "half" (set the value to half the MDL), "mdl" (set the value to equal to the MDL), or "na" (set the value to NA). Can also be set to "none" to leave as is.

Value

A tibble of the tidied rems data.

Details

It sets values that are flagged as being less than the detection limit to zero. It does not alter values that are flagged as being greater than the detection limit - that is left up to the user.