Skip to contents

`standardize_units_across()` standardizes the units used across a row of data.

Usage

standardize_units_across(
  .data,
  target_unit,
  unit,
  value,
  unit_format = "wqx",
  warn_only = TRUE
)

Arguments

.data

Dataframe

target_unit

String. Column that contains the units that all other columns should match.

unit

String. Column with units.

value

List or string. Column(s) with result values. If multiple columns are listed, then data in row will only update if the entire row can be updated.

unit_format

String. Format used for units. Not case sensitive. Accepted values: WQX, MassWateR, wqdashboard, RI_WW, RI_DEM, MA_BRC, ME_DEP, ME_FOCB. Default wqx.

warn_only

Boolean. If `TRUE`, returns a warning message if unable to convert units. If `FALSE`, returns an error message.

Value

Updated dataframe. Where possible, units will be standardized across the row. If units can not be standardized in a row, the units and values for that row will be left as-is.