R/convert_to_mmoll.R

Defines functions convert_to_mmoll

convert_to_mmoll <- function(x, from = "g/l") {
  switch(EXPR = tolower(from),
    "g/l" = {x / 0.18},
    "mg/l" = {x / 0.18 / 100},
    "mmol/l" = {x},
    stop("Please check Units: g/l, g/L, mg/l, mg/Ln, mmol/l or mmol/L!")
  )
}
mcanouil/mctools documentation built on Oct. 12, 2020, 10:21 p.m.