Skip to contents

Normalizes units for water quality parameters. Currently handles common conversions (mg/L to µg/L for phosphorus, unit standardization). Also validates expected unit ranges and emits warnings for values outside typical ranges.

Usage

clean_units(df, units_map = NULL)

Arguments

df

Input data frame / tibble.

units_map

Optional named list mapping parameter names to target units (currently used for validation only).

Value

The input df with normalized units. Currently performs:

  • Validation of unit ranges (warns if values are outside typical ranges)

  • No actual conversions are performed (returns input unchanged)

Details

This function is designed as an extension point. Future versions may implement actual unit conversions based on metadata or user specifications.

See also

Examples

df <- data.frame(ph = c(7, 7.2), od = c(6.5, 7.0), p_total = c(0.05, 0.08))
clean_units(df)
#>    ph  od p_total
#> 1 7.0 6.5    0.05
#> 2 7.2 7.0    0.08