Substitutes provided unit names for recognised units. Before matching all spaces and "units" or "UNITS" are removed. The case is not important. Where there are no matches missing values are returned.

substitute_units(x, messages = getOption("wqbc.messages", default = TRUE))

Arguments

x

The character vector of units to substitute.

messages

A flag indicating whether to print messages.

Examples

substitute_units(c("mg/L", "MG/L", "mg /L ", "Kg/l", "gkl"), messages = TRUE)
#> Substituted 'Kg/l' with 'kg/L', 'MG/L' with 'mg/L' and 'mg /L' with 'mg/L'.
#> Failed to substitute 'gkl'.
#> [1] "mg/L" "mg/L" "mg/L" "kg/L" NA