Skip to contents

Calculate Total Bilirubin Category

Usage

calculate_tbilcat(tbil, tbiluln)

Arguments

tbil

Total Bilirubin (mg/dL). Numeric vector.

tbiluln

Reference Range Upper Limit (same units as observed values). Numeric vector.

Value

This function returns a numeric vector the same length as its inputs

Details

Formula to calculate TBILCAT:
  if TBIL [mg/dL] <= ULN [mg/dL] then TBILCAT = 0
  if ULN [mg/dL] < TBIL [mg/dL] <= 1.5 × ULN [mg/dL] then TBILCAT = 1
  if 1.5 × ULN [mg/dL] < TBIL [mg/dL] <= 3 × ULN [mg/dL] then TBILCAT = 2
  if TBIL [mg/dL] > 3 × ULN [mg/dL] then TBILCAT = 3

References

Ramanathan RK, Egorin MJ, Takimoto CHM, Remick SC, Doroshow JH, LoRusso PA, et al. Phase I and pharmacokinetic study of imatinib mesylate in patients with advanced malignancies and varying degrees of liver dysfunction: a study by the national cancer institute organ dysfunction working group. J Clin Oncol. 2008;26:563-9.

Ramalingam SS, Kummar S, Sarantopoulos J, Shibata S, LoRusso P, Yerk M, et al. Phase I study of vorinostat in patients with advanced solid tumors and hepatic dysfunction: a National Cancer Institute Organ Dysfunction Working Group study. J Clin Oncol. 2010;28(29):4507-12.

Examples

library(dplyr)

dmcognigen_cov %>% 
  mutate(TBILCAT = calculate_tbilcat(tbil = TBIL, tbiluln = TBILULN))
#> Formula to calculate TBILCAT: 
#>   if TBIL [mg/dL] <= ULN [mg/dL] then TBILCAT = 0
#>   if ULN [mg/dL] < TBIL [mg/dL] <= 1.5 × ULN [mg/dL] then TBILCAT = 1
#>   if 1.5 × ULN [mg/dL] < TBIL [mg/dL] <= 3 × ULN [mg/dL] then TBILCAT = 2
#>   if TBIL [mg/dL] > 3 × ULN [mg/dL] then TBILCAT = 3
#> # A tibble: 254 × 53
#>    DOMAIN STUDYID USUBJID    ID RACEN RACEC  SEXF SEXFC  HTCM  WTKG   AST ASTULN
#>    <chr>  <chr>   <chr>   <dbl> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl>  <dbl>
#>  1 DM     CDISCP… 01-701… 10101     1 Whit…     1 Fema…  147.  54.4    40     34
#>  2 DM     CDISCP… 01-701… 10102     1 Whit…     0 Male   163.  80.3    21     36
#>  3 DM     CDISCP… 01-701… 10103     1 Whit…     0 Male   178.  99.3    24     36
#>  4 DM     CDISCP… 01-701… 10104     1 Whit…     0 Male   175.  88.4    20     36
#>  5 DM     CDISCP… 01-701… 10105     1 Whit…     1 Fema…  155.  62.6    23     34
#>  6 DM     CDISCP… 01-701… 10106     1 Whit…     1 Fema…  149.  67.1    25     34
#>  7 DM     CDISCP… 01-701… 10108     1 Whit…     0 Male   169.  78.0    19     36
#>  8 DM     CDISCP… 01-701… 10109     1 Whit…     1 Fema…  158.  59.9    28     34
#>  9 DM     CDISCP… 01-701… 10110     1 Whit…     0 Male   182.  78.9    26     36
#> 10 DM     CDISCP… 01-701… 10111     1 Whit…     0 Male   180.  71.2    15     36
#> # ℹ 244 more rows
#> # ℹ 41 more variables: SCR <dbl>, SCRULN <dbl>, TBIL <dbl>, TBILULN <dbl>,
#> #   ASTCAT <dbl>, BMI <dbl>, BSA <dbl>, IBW <dbl>, CRCL <dbl>, CRCLP <dbl>,
#> #   EGFR <dbl>, EGFRSCHW <dbl>, IBWCHILD <dbl>, LBM <dbl>, TBILCAT <dbl>,
#> #   RFCAT <dbl>, RFCATC <chr>, NCILIV <dbl>, NCILIVC <chr>, SUBJID <chr>,
#> #   RFSTDTC <chr>, RFENDTC <chr>, RFXSTDTC <chr>, RFXENDTC <chr>,
#> #   RFICDTC <chr>, RFPENDTC <chr>, DTHDTC <chr>, DTHFL <chr>, SITEID <chr>, …

# Below will also work if the dataset contains expected variables
dmcognigen_cov %>% 
  mutate(TBILCAT = calculate_tbilcat())
#> TBIL variable found and used for the tbil argument.
#> TBILULN variable found and used for the tbiluln argument.
#> Formula to calculate TBILCAT: 
#>   if TBIL [mg/dL] <= ULN [mg/dL] then TBILCAT = 0
#>   if ULN [mg/dL] < TBIL [mg/dL] <= 1.5 × ULN [mg/dL] then TBILCAT = 1
#>   if 1.5 × ULN [mg/dL] < TBIL [mg/dL] <= 3 × ULN [mg/dL] then TBILCAT = 2
#>   if TBIL [mg/dL] > 3 × ULN [mg/dL] then TBILCAT = 3
#> # A tibble: 254 × 53
#>    DOMAIN STUDYID USUBJID    ID RACEN RACEC  SEXF SEXFC  HTCM  WTKG   AST ASTULN
#>    <chr>  <chr>   <chr>   <dbl> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl>  <dbl>
#>  1 DM     CDISCP… 01-701… 10101     1 Whit…     1 Fema…  147.  54.4    40     34
#>  2 DM     CDISCP… 01-701… 10102     1 Whit…     0 Male   163.  80.3    21     36
#>  3 DM     CDISCP… 01-701… 10103     1 Whit…     0 Male   178.  99.3    24     36
#>  4 DM     CDISCP… 01-701… 10104     1 Whit…     0 Male   175.  88.4    20     36
#>  5 DM     CDISCP… 01-701… 10105     1 Whit…     1 Fema…  155.  62.6    23     34
#>  6 DM     CDISCP… 01-701… 10106     1 Whit…     1 Fema…  149.  67.1    25     34
#>  7 DM     CDISCP… 01-701… 10108     1 Whit…     0 Male   169.  78.0    19     36
#>  8 DM     CDISCP… 01-701… 10109     1 Whit…     1 Fema…  158.  59.9    28     34
#>  9 DM     CDISCP… 01-701… 10110     1 Whit…     0 Male   182.  78.9    26     36
#> 10 DM     CDISCP… 01-701… 10111     1 Whit…     0 Male   180.  71.2    15     36
#> # ℹ 244 more rows
#> # ℹ 41 more variables: SCR <dbl>, SCRULN <dbl>, TBIL <dbl>, TBILULN <dbl>,
#> #   ASTCAT <dbl>, BMI <dbl>, BSA <dbl>, IBW <dbl>, CRCL <dbl>, CRCLP <dbl>,
#> #   EGFR <dbl>, EGFRSCHW <dbl>, IBWCHILD <dbl>, LBM <dbl>, TBILCAT <dbl>,
#> #   RFCAT <dbl>, RFCATC <chr>, NCILIV <dbl>, NCILIVC <chr>, SUBJID <chr>,
#> #   RFSTDTC <chr>, RFENDTC <chr>, RFXSTDTC <chr>, RFXENDTC <chr>,
#> #   RFICDTC <chr>, RFPENDTC <chr>, DTHDTC <chr>, DTHFL <chr>, SITEID <chr>, …