Skip to contents

Get Unique Parameter-Unit Combinations

Usage

get_unique_units_df(params, units)

Arguments

params

a column from a dataset with lab parameters

units

a column from a dataset with units associated with those parameters

Value

a dataframe with distinct units and parameters with IU replaced to U and mu replaced with u

See also

Other unit_checking: check_for_unique_units()

Examples

df <- data.frame(
  PARAM = c(
    "ALB","ALT","AST","CR","TBIL",
    "ALB","CR","TBIL","ALT","AST"),
  UNIT = c(
    "g/L","U/L","U/L","umol/L","umol/L",
    "U/L","μmol/L","μmol/L","IU/L","IU/L")
)
get_unique_units_df(df$PARAM, df$UNIT)
#>   PARAM   UNIT
#> 1   ALB    g/L
#> 2   ALT    U/L
#> 3   AST    U/L
#> 4    CR umol/L
#> 5  TBIL umol/L
#> 6   ALB    U/L