convert_values | R Documentation |
Convert values to different units
convert_values(x, from, to, messages)
x |
a numeric vector of values to convert |
from |
units to convert from |
to |
units to convert to |
messages |
should messages be printed when |
Currently supported units for from
and to
are:
c("ng/L", "ug/L", "mg/L", "g/L", "kg/L", "pH", "degC", "C", "CFU/dL", "MPN/dL", "CFU/100mL", "MPN/100mL", "CFU/g", "MPN/g", "CFU/mL", "MPN/mL", "Col.unit", "Rel", "NTU", "m", "uS/cm")
a numeric vector of the converted values
convert_values(1, "ug/L", "mg/L", messages = FALSE) df <- data.frame( value = c(1.256, 5400000, 12300, .00098), units = c("mg/L", "ng/L", "ug/L", "g/L"), stringsAsFactors = FALSE ) df df$units_mg_L <- convert_values(df$value, from = df$units, to = "mg/L", messages = FALSE) df
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.