ln_convert_units | R Documentation |
Convert values to the default units for the lab
ln_convert_units(values, units, lab)
values |
a vector of lab values |
units |
the units of the lab values. See |
lab |
the lab name. See |
the values converted to the default units for the lab
# emulate a dataset with different units hemoglobin_diff_units <- hemoglobin_data # first 50 values will be in mg/ML hemoglobin_diff_units$value[1:50] <- hemoglobin_diff_units$value[1:50] * 10 # last 50 values will be in mmol/L hemoglobin_diff_units$value[51:100] <- hemoglobin_diff_units$value[51:100] / 1.61 converted <- ln_convert_units( hemoglobin_diff_units$value[1:100], c(rep("mg/mL", 50), rep("mmol/L", 50)), "Hemoglobin" ) head(converted) head(hemoglobin_data$value)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.