#1. Convert Glucose from US (mg/dL) to SI (mmol/L)
us_glucose <- 150
convert_lab_units(us_glucose, "Glucose", "US", "SI")
#2. Convert Creatinine from SI (umol/L) to US (mg/dL)
si_creatinine <- 110
convert_lab_units(si_creatinine, "Creatinine", "SI", "US")
#3. Handling analytes with a factor of 1 (Sodium)
convert_lab_units(140, "Sodium", "US", "SI")
#4. Error Case: Unsupported analyte
convert_lab_units(5, "TSH", "US", "SI")
Run the code above in your browser using DataLab