The calculations
family is a collection of functions
intended to facilitate the calculation of variables that mostly use
standard equations (e.g: CrCl, eGFR, BMI etc). This vignette
demonstrates:
- How these functions work when required variables are missing.
- Description of calculations functions.
- Examples use-cases.
In their simplest form, these functions apply and report formulas.
calculate_crcl(
age = 50,
scr = 1,
sexf = 0,
wtkg = 70
)
#> Formula to calculate CRCL:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> [1] 87.5
Detect missing variables from environment
When expected variables are missing, an attempt is made to detect them in the environment.
- The calculation function checks the calling environment for missing variables with a case-insensitive match.
- An error is raised if either no match is found or more than one match is found.
- If a single match is found, it is used and the user is notified.
Source datasets
For examples and testing, there are calculation-ready sample datasets incorporated into the package.
dmcognigen_cov
The dmcognigen_cov
dataset is a data.frame
with demographic/covariate information. It contains the variables
required for most calculation functions.
glimpse(dmcognigen_cov)
#> Rows: 254
#> Columns: 53
#> $ DOMAIN <chr> "DM", "DM", "DM", "DM", "DM", "DM", "DM", "DM", "DM", "DM", "…
#> $ STUDYID <chr> "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01…
#> $ USUBJID <chr> "01-701-1015", "01-701-1023", "01-701-1028", "01-701-1033", "…
#> $ ID <dbl> 10101, 10102, 10103, 10104, 10105, 10106, 10108, 10109, 10110…
#> $ RACEN <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1…
#> $ RACEC <chr> "White/Caucasian", "White/Caucasian", "White/Caucasian", "Whi…
#> $ SEXF <dbl> 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1…
#> $ SEXFC <chr> "Female", "Male", "Male", "Male", "Female", "Female", "Male",…
#> $ HTCM <dbl> 147.32, 162.56, 177.80, 175.26, 154.94, 148.59, 168.91, 158.2…
#> $ WTKG <dbl> 54.43, 80.29, 99.34, 88.45, 62.60, 67.13, 78.02, 59.88, 78.93…
#> $ AST <dbl> 40, 21, 24, 20, 23, 25, 19, 28, 26, 15, 24, 27, 14, 25, 24, 2…
#> $ ASTULN <dbl> 34, 36, 36, 36, 34, 34, 36, 34, 36, 36, 36, 34, 34, 36, 34, 3…
#> $ SCR <dbl> 0.9, 1.4, 1.4, 1.5, 1.0, 1.0, 1.4, 0.9, 1.3, 1.0, 1.4, 1.1, 0…
#> $ SCRULN <dbl> 1.4, 1.6, 1.6, 1.6, 1.4, 1.4, 1.6, 1.4, 1.6, 1.6, 1.6, 1.4, 1…
#> $ TBIL <dbl> 0.6, 0.7, 1.1, 0.8, 0.6, 0.4, 0.4, 0.4, 0.5, 0.7, 0.5, 0.9, 0…
#> $ TBILULN <dbl> 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1…
#> $ ASTCAT <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ BMI <dbl> 25.07927, 30.38324, 31.42394, 28.79600, 26.07638, 30.40447, 2…
#> $ BSA <dbl> 1.514484, 1.928392, 2.234674, 2.092314, 1.662531, 1.693187, 1…
#> $ IBW <dbl> 45.37000, 59.05000, 70.15000, 68.30000, 50.32000, 46.19500, 6…
#> $ CRCL <dbl> 54.97598, 60.53611, 68.00060, 54.05278, 46.55875, 43.58788, 5…
#> $ CRCLP <dbl> 54.97598, 44.52183, 48.01935, 41.73889, 37.42550, 29.99467, 4…
#> $ EGFR <dbl> 63.23827, 51.02133, 49.95752, 45.74827, 53.76310, 52.69506, 5…
#> $ EGFRSCHW <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ IBWCHILD <dbl> 35.81025, 43.60249, 52.16119, 50.68151, 39.61057, 36.43033, 4…
#> $ LBM <dbl> 38.03714, 57.09378, 69.31683, 64.69332, 42.82276, 41.62153, 5…
#> $ TBILCAT <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ RFCAT <dbl> 2, 3, 3, 3, 3, 3, 3, 2, 3, 2, 3, 3, 2, 2, 3, 3, 3, NA, 2, 2, …
#> $ RFCATC <chr> "Mild Impairment (60-89 mL/min)", "Moderate Impairment (30-59…
#> $ NCILIV <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ NCILIVC <chr> "Mild Group B1", "Normal Group A", "Normal Group A", "Normal …
#> $ SUBJID <chr> "1015", "1023", "1028", "1033", "1034", "1047", "1097", "1111…
#> $ RFSTDTC <chr> "2014-01-02", "2012-08-05", "2013-07-19", "2014-03-18", "2014…
#> $ RFENDTC <chr> "2014-07-02", "2012-09-02", "2014-01-14", "2014-04-14", "2014…
#> $ RFXSTDTC <chr> "2014-01-02", "2012-08-05", "2013-07-19", "2014-03-18", "2014…
#> $ RFXENDTC <chr> "2014-07-02", "2012-09-01", "2014-01-14", "2014-03-31", "2014…
#> $ RFICDTC <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ RFPENDTC <chr> "2014-07-02T11:45", "2013-02-18", "2014-01-14T11:10", "2014-0…
#> $ DTHDTC <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ DTHFL <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ SITEID <chr> "701", "701", "701", "701", "701", "701", "701", "701", "701"…
#> $ AGE <dbl> 63, 64, 71, 74, 77, 85, 68, 81, 84, 52, 84, 81, 75, 57, 79, 5…
#> $ AGEU <chr> "YEARS", "YEARS", "YEARS", "YEARS", "YEARS", "YEARS", "YEARS"…
#> $ SEX <chr> "F", "M", "M", "M", "F", "F", "M", "F", "M", "M", "M", "F", "…
#> $ RACE <chr> "WHITE", "WHITE", "WHITE", "WHITE", "WHITE", "WHITE", "WHITE"…
#> $ ETHNIC <chr> "HISPANIC OR LATINO", "HISPANIC OR LATINO", "NOT HISPANIC OR …
#> $ ARMCD <chr> "Pbo", "Pbo", "Xan_Hi", "Xan_Lo", "Xan_Hi", "Pbo", "Xan_Lo", …
#> $ ARM <chr> "Placebo", "Placebo", "Xanomeline High Dose", "Xanomeline Low…
#> $ ACTARMCD <chr> "Pbo", "Pbo", "Xan_Hi", "Xan_Lo", "Xan_Hi", "Pbo", "Xan_Lo", …
#> $ ACTARM <chr> "Placebo", "Placebo", "Xanomeline High Dose", "Xanomeline Low…
#> $ COUNTRY <chr> "USA", "USA", "USA", "USA", "USA", "USA", "USA", "USA", "USA"…
#> $ DMDTC <chr> "2013-12-26", "2012-07-22", "2013-07-11", "2014-03-10", "2014…
#> $ DMDY <dbl> -7, -14, -8, -8, -7, -21, -9, -13, -7, -13, -6, -5, -13, -9, …
dmcognigen_conc
The dmcognigen_conc
dataset is a data.frame
with concentration variables.
glimpse(dmcognigen_conc)
#> Rows: 3,556
#> Columns: 30
#> $ DOMAIN <chr> "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "…
#> $ STUDYID <chr> "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01…
#> $ USUBJID <chr> "01-701-1015", "01-701-1015", "01-701-1015", "01-701-1015", "…
#> $ DVID <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
#> $ DVIDC <chr> "Xanomeline Concentration (ug/mL)", "Xanomeline Concentration…
#> $ EVID <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ MDV <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ DV <dbl> 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005…
#> $ LOGDV <dbl> -5.298317, -5.298317, -5.298317, -5.298317, -5.298317, -5.298…
#> $ BLQFN <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
#> $ LLOQ <dbl> 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0…
#> $ DTTM <dttm> 2014-01-01 23:30:00, 2014-01-02 00:05:00, 2014-01-02 00:30:0…
#> $ DAY <dbl> -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, -1, 1, 1, 1, 1, 1,…
#> $ PCSEQ <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5,…
#> $ PCTESTCD <chr> "XAN", "XAN", "XAN", "XAN", "XAN", "XAN", "XAN", "XAN", "XAN"…
#> $ PCTEST <chr> "XANOMELINE", "XANOMELINE", "XANOMELINE", "XANOMELINE", "XANO…
#> $ PCORRES <chr> "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ…
#> $ PCORRESU <chr> "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml"…
#> $ PCSTRESC <chr> "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ", "<BLQ…
#> $ PCSTRESN <dbl> 0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, NA,…
#> $ PCSTRESU <chr> "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml", "ug/ml"…
#> $ PCNAM <chr> "Imaginary Labs", "Imaginary Labs", "Imaginary Labs", "Imagin…
#> $ PCSPEC <chr> "PLASMA", "PLASMA", "PLASMA", "PLASMA", "PLASMA", "PLASMA", "…
#> $ PCLLOQ <dbl> 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0…
#> $ VISIT <chr> "BASELINE", "BASELINE", "BASELINE", "BASELINE", "BASELINE", "…
#> $ VISITNUM <dbl> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3…
#> $ PCDTC <chr> "2014-01-01T23:30:00", "2014-01-02T00:05:00", "2014-01-02T00:…
#> $ PCDY <dbl> -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, -1, 1, 1, 1, 1, 1,…
#> $ PCTPT <chr> "Pre-dose", "5 Min Post-dose", "30 Min Post-dose", "1h Post-d…
#> $ PCTPTNUM <dbl> -0.50, 0.08, 0.50, 1.00, 1.50, 2.00, 4.00, 6.00, 8.00, 12.00,…
Functions
Each function performs calculations according to some formula, so the
same function can be used to calculate both baseline and time-varying
versions of a variable. For instance, calculate_bmi
can
calculate both BMI
(baseline) and BMIT
(time-varying). If you provide time varying WTKG
and
HTCM
, then the result will be time-varying. Each function
prints the formula that was used in a readable format.
calculate_crcl()
Calculate Creatinine Clearance (CrCl), a measure of renal function based on age, weight, gender, and serum creatinine. This is the Cockcroft and Gault Formula.
Males: CRCL [mL/min] = ((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL]) Females: CRCL [mL/min] = (((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
age
: Age (y). Numeric vector. -
wtkg
: Weight (kg). Numeric vector. -
scr
: Serum Creatinine (mg/dL). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
CRCL = calculate_crcl(
age = AGE,
scr = SCR,
sexf = SEXF,
wtkg = WTKG
)
) %>%
select(USUBJID, AGE, SCR, SEXF, WTKG, CRCL)
#> Formula to calculate CRCL:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> # A tibble: 254 × 6
#> USUBJID AGE SCR SEXF WTKG CRCL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 0.9 1 54.4 55.0
#> 2 01-701-1023 64 1.4 0 80.3 60.5
#> 3 01-701-1028 71 1.4 0 99.3 68.0
#> 4 01-701-1033 74 1.5 0 88.4 54.1
#> 5 01-701-1034 77 1 1 62.6 46.6
#> 6 01-701-1047 85 1 1 67.1 43.6
#> 7 01-701-1097 68 1.4 0 78.0 55.7
#> 8 01-701-1111 81 0.9 1 59.9 46.3
#> 9 01-701-1115 84 1.3 0 78.9 47.2
#> 10 01-701-1118 52 1 0 71.2 87.0
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
CRCL = calculate_crcl()
) %>%
select(USUBJID, AGE, SCR, SEXF, WTKG, CRCL)
#> AGE variable found and used for the age argument.
#> SCR variable found and used for the scr argument.
#> SEXF variable found and used for the sexf argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate CRCL:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> # A tibble: 254 × 6
#> USUBJID AGE SCR SEXF WTKG CRCL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 0.9 1 54.4 55.0
#> 2 01-701-1023 64 1.4 0 80.3 60.5
#> 3 01-701-1028 71 1.4 0 99.3 68.0
#> 4 01-701-1033 74 1.5 0 88.4 54.1
#> 5 01-701-1034 77 1 1 62.6 46.6
#> 6 01-701-1047 85 1 1 67.1 43.6
#> 7 01-701-1097 68 1.4 0 78.0 55.7
#> 8 01-701-1111 81 0.9 1 59.9 46.3
#> 9 01-701-1115 84 1.3 0 78.9 47.2
#> 10 01-701-1118 52 1 0 71.2 87.0
#> # ℹ 244 more rows
dmcognigen_cov %>%
mutate(
CRCL = calculate_crcl(age = AGE)
) %>%
select(USUBJID, AGE, SCR, SEXF, WTKG, CRCL)
#> SCR variable found and used for the scr argument.
#> SEXF variable found and used for the sexf argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate CRCL:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × WTKG [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> # A tibble: 254 × 6
#> USUBJID AGE SCR SEXF WTKG CRCL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 0.9 1 54.4 55.0
#> 2 01-701-1023 64 1.4 0 80.3 60.5
#> 3 01-701-1028 71 1.4 0 99.3 68.0
#> 4 01-701-1033 74 1.5 0 88.4 54.1
#> 5 01-701-1034 77 1 1 62.6 46.6
#> 6 01-701-1047 85 1 1 67.1 43.6
#> 7 01-701-1097 68 1.4 0 78.0 55.7
#> 8 01-701-1111 81 0.9 1 59.9 46.3
#> 9 01-701-1115 84 1.3 0 78.9 47.2
#> 10 01-701-1118 52 1 0 71.2 87.0
#> # ℹ 244 more rows
calculate_crcl_peck()
Calculate Creatinine Clearance (CrCl) using the Peck Formula, a measure of renal function based on age, ideal weight, gender, and serum creatinine
If WTKG [kg] < 120% of IBW [kg], CRCL [mL/min] = CRCL [mL/min] (Cockroft & Gault) If WTKG [kg] >= 120% of IBW [kg]: Males: CRCL [mL/min] = ((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL]) Females: CRCL [mL/min] = (((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
age
: Age (y). Numeric vector. -
crcl
: Creatinine Clearance (mL/min) -
ibw
: Ideal Body Weight (kg). Numeric vector. -
scr
: Serum Creatinine (mg/dL). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female. -
wtkg
: Weight (kg). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
CRCLP = calculate_crcl_peck(
age = AGE,
crcl = CRCL,
ibw = IBW,
scr = SCR,
sexf = SEXF,
wtkg = WTKG
)
) %>%
select(USUBJID, AGE, CRCL, IBW, SCR, SEXF, WTKG, CRCLP)
#> Formula to calculate CRCL_PECK:
#> If WTKG [kg] < 120% of IBW [kg], CRCL [mL/min] = CRCL [mL/min] (Cockroft & Gault)
#> If WTKG [kg] >= 120% of IBW [kg]:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> # A tibble: 254 × 8
#> USUBJID AGE CRCL IBW SCR SEXF WTKG CRCLP
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 55.0 45.4 0.9 1 54.4 55.0
#> 2 01-701-1023 64 60.5 59.0 1.4 0 80.3 44.5
#> 3 01-701-1028 71 68.0 70.2 1.4 0 99.3 48.0
#> 4 01-701-1033 74 54.1 68.3 1.5 0 88.4 41.7
#> 5 01-701-1034 77 46.6 50.3 1 1 62.6 37.4
#> 6 01-701-1047 85 43.6 46.2 1 1 67.1 30.0
#> 7 01-701-1097 68 55.7 63.7 1.4 0 78.0 45.5
#> 8 01-701-1111 81 46.3 52.5 0.9 1 59.9 46.3
#> 9 01-701-1115 84 47.2 72.9 1.3 0 78.9 47.2
#> 10 01-701-1118 52 87.0 72 1 0 71.2 87.0
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
CRCLP = calculate_crcl_peck()
) %>%
select(USUBJID, AGE, CRCL, IBW, SCR, SEXF, WTKG, CRCLP)
#> AGE variable found and used for the age argument.
#> CRCL variable found and used for the crcl argument.
#> IBW variable found and used for the ibw argument.
#> SCR variable found and used for the scr argument.
#> SEXF variable found and used for the sexf argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate CRCL_PECK:
#> If WTKG [kg] < 120% of IBW [kg], CRCL [mL/min] = CRCL [mL/min] (Cockroft & Gault)
#> If WTKG [kg] >= 120% of IBW [kg]:
#> Males: CRCL [mL/min] = ((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL])
#> Females: CRCL [mL/min] = (((140 - AGE [y]) × IBW [kg]) ÷ (72 × SCR [mg/dL])) × 0.85
#> # A tibble: 254 × 8
#> USUBJID AGE CRCL IBW SCR SEXF WTKG CRCLP
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 55.0 45.4 0.9 1 54.4 55.0
#> 2 01-701-1023 64 60.5 59.0 1.4 0 80.3 44.5
#> 3 01-701-1028 71 68.0 70.2 1.4 0 99.3 48.0
#> 4 01-701-1033 74 54.1 68.3 1.5 0 88.4 41.7
#> 5 01-701-1034 77 46.6 50.3 1 1 62.6 37.4
#> 6 01-701-1047 85 43.6 46.2 1 1 67.1 30.0
#> 7 01-701-1097 68 55.7 63.7 1.4 0 78.0 45.5
#> 8 01-701-1111 81 46.3 52.5 0.9 1 59.9 46.3
#> 9 01-701-1115 84 47.2 72.9 1.3 0 78.9 47.2
#> 10 01-701-1118 52 87.0 72 1 0 71.2 87.0
#> # ℹ 244 more rows
calculate_bmi()
Calculate Body Mass Index (BMI). BMI is a measure of body fat based on height and weight
BMI [kg/m^2] = WTKG [kg] ÷ (HTCM [cm] ÷ 100) ^ 2
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
htcm
: Height (cm). Numeric vector. -
wtkg
: Weight (kg). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
BMI = calculate_bmi(
htcm = HTCM,
wtkg = WTKG
)
) %>%
select(USUBJID, HTCM, WTKG, BMI)
#> Formula to calculate BMI:
#> BMI [kg/m^2] = WTKG [kg] ÷ (HTCM [cm] ÷ 100) ^ 2
#> # A tibble: 254 × 4
#> USUBJID HTCM WTKG BMI
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 54.4 25.1
#> 2 01-701-1023 163. 80.3 30.4
#> 3 01-701-1028 178. 99.3 31.4
#> 4 01-701-1033 175. 88.4 28.8
#> 5 01-701-1034 155. 62.6 26.1
#> 6 01-701-1047 149. 67.1 30.4
#> 7 01-701-1097 169. 78.0 27.3
#> 8 01-701-1111 158. 59.9 23.9
#> 9 01-701-1115 182. 78.9 23.9
#> 10 01-701-1118 180. 71.2 21.9
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
BMI = calculate_bmi()
) %>%
select(USUBJID, HTCM, WTKG, BMI)
#> HTCM variable found and used for the htcm argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate BMI:
#> BMI [kg/m^2] = WTKG [kg] ÷ (HTCM [cm] ÷ 100) ^ 2
#> # A tibble: 254 × 4
#> USUBJID HTCM WTKG BMI
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 54.4 25.1
#> 2 01-701-1023 163. 80.3 30.4
#> 3 01-701-1028 178. 99.3 31.4
#> 4 01-701-1033 175. 88.4 28.8
#> 5 01-701-1034 155. 62.6 26.1
#> 6 01-701-1047 149. 67.1 30.4
#> 7 01-701-1097 169. 78.0 27.3
#> 8 01-701-1111 158. 59.9 23.9
#> 9 01-701-1115 182. 78.9 23.9
#> 10 01-701-1118 180. 71.2 21.9
#> # ℹ 244 more rows
calculate_bsa()
Calculate Body Surface Area (BSA). Body Surface Area is a measure of body fat based on height and weight
BSA [m^2] = ((HTCM [cm]) ^ 0.42246 * (WTKG [kg]) ^ 0.51456) * 0.0235
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
htcm
: Height (cm). Numeric vector. -
wtkg
: Weight (kg). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
BSA = calculate_bsa(
htcm = HTCM,
wtkg = WTKG
)
) %>%
select(USUBJID, HTCM, WTKG, BSA)
#> Formula to calculate BSA:
#> BSA [m^2] = ((HTCM [cm]) ^ 0.42246 * (WTKG [kg]) ^ 0.51456) * 0.0235
#> # A tibble: 254 × 4
#> USUBJID HTCM WTKG BSA
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 54.4 1.51
#> 2 01-701-1023 163. 80.3 1.93
#> 3 01-701-1028 178. 99.3 2.23
#> 4 01-701-1033 175. 88.4 2.09
#> 5 01-701-1034 155. 62.6 1.66
#> 6 01-701-1047 149. 67.1 1.69
#> 7 01-701-1097 169. 78.0 1.93
#> 8 01-701-1111 158. 59.9 1.64
#> 9 01-701-1115 182. 78.9 2.00
#> 10 01-701-1118 180. 71.2 1.89
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
BSA = calculate_bsa()
) %>%
select(USUBJID, HTCM, WTKG, BSA)
#> HTCM variable found and used for the htcm argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate BSA:
#> BSA [m^2] = ((HTCM [cm]) ^ 0.42246 * (WTKG [kg]) ^ 0.51456) * 0.0235
#> # A tibble: 254 × 4
#> USUBJID HTCM WTKG BSA
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 54.4 1.51
#> 2 01-701-1023 163. 80.3 1.93
#> 3 01-701-1028 178. 99.3 2.23
#> 4 01-701-1033 175. 88.4 2.09
#> 5 01-701-1034 155. 62.6 1.66
#> 6 01-701-1047 149. 67.1 1.69
#> 7 01-701-1097 169. 78.0 1.93
#> 8 01-701-1111 158. 59.9 1.64
#> 9 01-701-1115 182. 78.9 2.00
#> 10 01-701-1118 180. 71.2 1.89
#> # ℹ 244 more rows
calculate_lbm()
Calculate Lean Body Mass (LBM), an estimation of how much someone weighs without the body fat; how much a persons bones, organs and muscles weigh
Males: LBM [kg] = (1.10 × WTKG [kg]) - 128 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2) Females: LBM [kg] = (1.07 × WTKG [kg]) - 148 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2)
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
htcm
: Height (cm). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female. -
wtkg
: Weight (kg). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
LBM = calculate_lbm(
htcm = HTCM,
sexf = SEXF,
wtkg = WTKG
)
) %>%
select(USUBJID, HTCM, SEXF, WTKG, LBM)
#> Formula to calculate LBM:
#> Males: LBM [kg] = (1.10 × WTKG [kg]) - 128 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2)
#> Females: LBM [kg] = (1.07 × WTKG [kg]) - 148 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2)
#> # A tibble: 254 × 5
#> USUBJID HTCM SEXF WTKG LBM
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 1 54.4 38.0
#> 2 01-701-1023 163. 0 80.3 57.1
#> 3 01-701-1028 178. 0 99.3 69.3
#> 4 01-701-1033 175. 0 88.4 64.7
#> 5 01-701-1034 155. 1 62.6 42.8
#> 6 01-701-1047 149. 1 67.1 41.6
#> 7 01-701-1097 169. 0 78.0 58.5
#> 8 01-701-1111 158. 1 59.9 42.9
#> 9 01-701-1115 182. 0 78.9 62.6
#> 10 01-701-1118 180. 0 71.2 58.4
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
LBM = calculate_lbm()
) %>%
select(USUBJID, HTCM, SEXF, WTKG, LBM)
#> HTCM variable found and used for the htcm argument.
#> SEXF variable found and used for the sexf argument.
#> WTKG variable found and used for the wtkg argument.
#> Formula to calculate LBM:
#> Males: LBM [kg] = (1.10 × WTKG [kg]) - 128 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2)
#> Females: LBM [kg] = (1.07 × WTKG [kg]) - 148 × ((WTKG [kg]) ^ 2 ÷ (HTCM [cm]) ^ 2)
#> # A tibble: 254 × 5
#> USUBJID HTCM SEXF WTKG LBM
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 1 54.4 38.0
#> 2 01-701-1023 163. 0 80.3 57.1
#> 3 01-701-1028 178. 0 99.3 69.3
#> 4 01-701-1033 175. 0 88.4 64.7
#> 5 01-701-1034 155. 1 62.6 42.8
#> 6 01-701-1047 149. 1 67.1 41.6
#> 7 01-701-1097 169. 0 78.0 58.5
#> 8 01-701-1111 158. 1 59.9 42.9
#> 9 01-701-1115 182. 0 78.9 62.6
#> 10 01-701-1118 180. 0 71.2 58.4
#> # ℹ 244 more rows
calculate_ibw()
Calculate Ideal Body Weight (IBW), a measure of potential body fat based on height
Males: IBW [kg] = 51.65 [kg] + 1.85 [kg] × ((HTCM [cm] ÷ 2.54) - 60) Females: IBW [kg] = 48.67 [kg] + 1.65 [kg] × ((HTCM [cm] ÷ 2.54) - 60)
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
htcm
: Height (cm). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
IBW = calculate_ibw(
htcm = HTCM,
sexf = SEXF
)
) %>%
select(USUBJID, HTCM, SEXF, IBW)
#> Formula to calculate IBW:
#> Males: IBW [kg] = 51.65 [kg] + 1.85 [kg] × ((HTCM [cm] ÷ 2.54) - 60)
#> Females: IBW [kg] = 48.67 [kg] + 1.65 [kg] × ((HTCM [cm] ÷ 2.54) - 60)
#> # A tibble: 254 × 4
#> USUBJID HTCM SEXF IBW
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 1 45.4
#> 2 01-701-1023 163. 0 59.0
#> 3 01-701-1028 178. 0 70.2
#> 4 01-701-1033 175. 0 68.3
#> 5 01-701-1034 155. 1 50.3
#> 6 01-701-1047 149. 1 46.2
#> 7 01-701-1097 169. 0 63.7
#> 8 01-701-1111 158. 1 52.5
#> 9 01-701-1115 182. 0 72.9
#> 10 01-701-1118 180. 0 72
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
IBW = calculate_ibw()
) %>%
select(USUBJID, HTCM, SEXF, IBW)
#> HTCM variable found and used for the htcm argument.
#> SEXF variable found and used for the sexf argument.
#> Formula to calculate IBW:
#> Males: IBW [kg] = 51.65 [kg] + 1.85 [kg] × ((HTCM [cm] ÷ 2.54) - 60)
#> Females: IBW [kg] = 48.67 [kg] + 1.65 [kg] × ((HTCM [cm] ÷ 2.54) - 60)
#> # A tibble: 254 × 4
#> USUBJID HTCM SEXF IBW
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 147. 1 45.4
#> 2 01-701-1023 163. 0 59.0
#> 3 01-701-1028 178. 0 70.2
#> 4 01-701-1033 175. 0 68.3
#> 5 01-701-1034 155. 1 50.3
#> 6 01-701-1047 149. 1 46.2
#> 7 01-701-1097 169. 0 63.7
#> 8 01-701-1111 158. 1 52.5
#> 9 01-701-1115 182. 0 72.9
#> 10 01-701-1118 180. 0 72
#> # ℹ 244 more rows
calculate_ibw_child()
Calculate Ideal Body Weight (for children), a measure of potential body fat based on height
IBW [kg] = [(HTCM [cm]) ^ 2 × 1.65] ÷ 1000
This function returns a numeric vector the same length as its inputs. Following is the input:
-
age
: Age (y). Numeric vector. -
htcm
: Height (cm). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
IBWCHILD = calculate_ibw_child(age = AGE, htcm = HTCM)
) %>%
select(USUBJID, AGE, HTCM, IBWCHILD)
#> Formula to calculate IBW_CHILD:
#> IBW [kg] = [(HTCM [cm]) ^ 2 × 1.65] ÷ 1000
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `IBWCHILD = calculate_ibw_child(age = AGE, htcm = HTCM)`.
#> Caused by warning:
#> ! Cases where AGE > 18 were detected. This formula is intended for children.
#> # A tibble: 254 × 4
#> USUBJID AGE HTCM IBWCHILD
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 147. 35.8
#> 2 01-701-1023 64 163. 43.6
#> 3 01-701-1028 71 178. 52.2
#> 4 01-701-1033 74 175. 50.7
#> 5 01-701-1034 77 155. 39.6
#> 6 01-701-1047 85 149. 36.4
#> 7 01-701-1097 68 169. 47.1
#> 8 01-701-1111 81 158. 41.3
#> 9 01-701-1115 84 182. 54.4
#> 10 01-701-1118 52 180. 53.7
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
IBWCHILD = calculate_ibw_child()
) %>%
select(USUBJID, AGE, HTCM, IBWCHILD)
#> AGE variable found and used for the age argument.
#> HTCM variable found and used for the htcm argument.
#> Formula to calculate IBW_CHILD:
#> IBW [kg] = [(HTCM [cm]) ^ 2 × 1.65] ÷ 1000
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `IBWCHILD = calculate_ibw_child()`.
#> Caused by warning:
#> ! Cases where AGE > 18 were detected. This formula is intended for children.
#> # A tibble: 254 × 4
#> USUBJID AGE HTCM IBWCHILD
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 147. 35.8
#> 2 01-701-1023 64 163. 43.6
#> 3 01-701-1028 71 178. 52.2
#> 4 01-701-1033 74 175. 50.7
#> 5 01-701-1034 77 155. 39.6
#> 6 01-701-1047 85 149. 36.4
#> 7 01-701-1097 68 169. 47.1
#> 8 01-701-1111 81 158. 41.3
#> 9 01-701-1115 84 182. 54.4
#> 10 01-701-1118 52 180. 53.7
#> # ℹ 244 more rows
calculate_egfr()
Calculate Estimated Glomerular Filtration Rate (eGFR) for adults
EGFR [mL/min/1.73m^2] = 175 × (SCR [mg/dL] ^ -1.154) × (AGE [y] ^ -0.203) × (0.742 if female) × (1.212 if African American)
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
age
: Age (y). Numeric vector. -
racen
: Race. Numeric vector where the value 2 is expected to correspond to Black/African American. -
scr
: Serum Creatinine (mg/dL). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
EGFR = calculate_egfr(
age = AGE,
racen = RACEN,
scr = SCR,
sexf = SEXF
)
) %>%
select(USUBJID, AGE, RACEN, SCR, SEXF, EGFR)
#> Formula to calculate EGFR:
#> EGFR [mL/min/1.73m^2] = 175 × (SCR [mg/dL] ^ -1.154) × (AGE [y] ^ -0.203) × (0.742 if female) × (1.212 if African American)
#> # A tibble: 254 × 6
#> USUBJID AGE RACEN SCR SEXF EGFR
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 1 0.9 1 63.2
#> 2 01-701-1023 64 1 1.4 0 51.0
#> 3 01-701-1028 71 1 1.4 0 50.0
#> 4 01-701-1033 74 1 1.5 0 45.7
#> 5 01-701-1034 77 1 1 1 53.8
#> 6 01-701-1047 85 1 1 1 52.7
#> 7 01-701-1097 68 1 1.4 0 50.4
#> 8 01-701-1111 81 1 0.9 1 60.1
#> 9 01-701-1115 84 1 1.3 0 52.6
#> 10 01-701-1118 52 1 1 0 78.5
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
EGFR = calculate_egfr()
) %>%
select(USUBJID, AGE, RACEN, SCR, SEXF, EGFR)
#> AGE variable found and used for the age argument.
#> RACEN variable found and used for the racen argument.
#> SCR variable found and used for the scr argument.
#> SEXF variable found and used for the sexf argument.
#> Formula to calculate EGFR:
#> EGFR [mL/min/1.73m^2] = 175 × (SCR [mg/dL] ^ -1.154) × (AGE [y] ^ -0.203) × (0.742 if female) × (1.212 if African American)
#> # A tibble: 254 × 6
#> USUBJID AGE RACEN SCR SEXF EGFR
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 1 0.9 1 63.2
#> 2 01-701-1023 64 1 1.4 0 51.0
#> 3 01-701-1028 71 1 1.4 0 50.0
#> 4 01-701-1033 74 1 1.5 0 45.7
#> 5 01-701-1034 77 1 1 1 53.8
#> 6 01-701-1047 85 1 1 1 52.7
#> 7 01-701-1097 68 1 1.4 0 50.4
#> 8 01-701-1111 81 1 0.9 1 60.1
#> 9 01-701-1115 84 1 1.3 0 52.6
#> 10 01-701-1118 52 1 1 0 78.5
#> # ℹ 244 more rows
calculate_egfr_child()
Calculate Estimated Glomerular Filtration Rate (eGFR) for Pedatrics using the Schwartz formula
Children (AGE [y] <= 16), where: EGFR = (k * HTCM [cm]) / SCR [mg/dL] k = 0.45 for AGE [y] <= 1 (full term) k = 0.55 for girls 1 < AGE [y] <= 16 k = 0.55 for boys 1 < AGE [y] < 13 k = 0.70 for boys 13 <= AGE [y] <= 16
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
age
: Age (y). Numeric vector. -
htcm
: Height (cm). Numeric vector. -
scr
: Serum Creatinine (mg/dL). Numeric vector. -
sexf
: Sex. Numeric vector including values of 0 and/or 1. 0=Male; 1=Female.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
EGFR_CHILD = calculate_egfr_child(
age = AGE,
htcm = HTCM,
scr = SCR,
sexf = SEXF
)
) %>%
select(USUBJID, AGE, HTCM, SCR, SEXF, EGFR_CHILD)
#> Formula to calculate EGFR_CHILD:
#> Children (AGE [y] <= 16), where:
#> EGFR = (k * HTCM [cm]) / SCR [mg/dL]
#> k = 0.45 for AGE [y] <= 1 (full term)
#> k = 0.55 for girls 1 < AGE [y] <= 16
#> k = 0.55 for boys 1 < AGE [y] < 13
#> k = 0.70 for boys 13 <= AGE [y] <= 16
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `EGFR_CHILD = calculate_egfr_child(age = AGE, htcm = HTCM, scr =
#> SCR, sexf = SEXF)`.
#> Caused by warning:
#> ! Cases where AGE > 16 were detected. This formula is intended for children.
#> # A tibble: 254 × 6
#> USUBJID AGE HTCM SCR SEXF EGFR_CHILD
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 147. 0.9 1 NA
#> 2 01-701-1023 64 163. 1.4 0 NA
#> 3 01-701-1028 71 178. 1.4 0 NA
#> 4 01-701-1033 74 175. 1.5 0 NA
#> 5 01-701-1034 77 155. 1 1 NA
#> 6 01-701-1047 85 149. 1 1 NA
#> 7 01-701-1097 68 169. 1.4 0 NA
#> 8 01-701-1111 81 158. 0.9 1 NA
#> 9 01-701-1115 84 182. 1.3 0 NA
#> 10 01-701-1118 52 180. 1 0 NA
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
EGFR_CHILD = calculate_egfr_child()
) %>%
select(USUBJID, AGE, HTCM, SCR, SEXF, EGFR_CHILD)
#> AGE variable found and used for the age argument.
#> HTCM variable found and used for the htcm argument.
#> SCR variable found and used for the scr argument.
#> SEXF variable found and used for the sexf argument.
#> Formula to calculate EGFR_CHILD:
#> Children (AGE [y] <= 16), where:
#> EGFR = (k * HTCM [cm]) / SCR [mg/dL]
#> k = 0.45 for AGE [y] <= 1 (full term)
#> k = 0.55 for girls 1 < AGE [y] <= 16
#> k = 0.55 for boys 1 < AGE [y] < 13
#> k = 0.70 for boys 13 <= AGE [y] <= 16
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `EGFR_CHILD = calculate_egfr_child()`.
#> Caused by warning:
#> ! Cases where AGE > 16 were detected. This formula is intended for children.
#> # A tibble: 254 × 6
#> USUBJID AGE HTCM SCR SEXF EGFR_CHILD
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 01-701-1015 63 147. 0.9 1 NA
#> 2 01-701-1023 64 163. 1.4 0 NA
#> 3 01-701-1028 71 178. 1.4 0 NA
#> 4 01-701-1033 74 175. 1.5 0 NA
#> 5 01-701-1034 77 155. 1 1 NA
#> 6 01-701-1047 85 149. 1 1 NA
#> 7 01-701-1097 68 169. 1.4 0 NA
#> 8 01-701-1111 81 158. 0.9 1 NA
#> 9 01-701-1115 84 182. 1.3 0 NA
#> 10 01-701-1118 52 180. 1 0 NA
#> # ℹ 244 more rows
calculate_rfcat()
Calculate Renal Function Category (RFCAT)
1 = Normal Function (>= 90 mL/min) 2 = Mild Impairment (60-89 mL/min) 3 = Moderate Impairment (30-59 mL/min) 4 = Severe Impairment (15-29 mL/min) 5 = End Stage Disease (< 15 mL/min or Dialysis)
This function returns a numeric vector the same length as its inputs. Following is the input:
-
egfr
: Estimated Glomerular Filtration Rate (mL/min/1.73m^2). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
EGFR = calculate_egfr(
age = AGE,
racen = RACEN,
scr = SCR,
sexf = SEXF
),
RFCAT = calculate_rfcat(egfr = EGFR)
) %>%
select(USUBJID, EGFR, RFCAT)
#> Formula to calculate EGFR:
#> EGFR [mL/min/1.73m^2] = 175 × (SCR [mg/dL] ^ -1.154) × (AGE [y] ^ -0.203) × (0.742 if female) × (1.212 if African American)
#> Formula to calculate RFCAT:
#> 1 = Normal Function (>= 90 mL/min)
#> 2 = Mild Impairment (60-89 mL/min)
#> 3 = Moderate Impairment (30-59 mL/min)
#> 4 = Severe Impairment (15-29 mL/min)
#> 5 = End Stage Disease (< 15 mL/min or Dialysis)
#> # A tibble: 254 × 3
#> USUBJID EGFR RFCAT
#> <chr> <dbl> <dbl>
#> 1 01-701-1015 63.2 2
#> 2 01-701-1023 51.0 3
#> 3 01-701-1028 50.0 3
#> 4 01-701-1033 45.7 3
#> 5 01-701-1034 53.8 3
#> 6 01-701-1047 52.7 3
#> 7 01-701-1097 50.4 3
#> 8 01-701-1111 60.1 2
#> 9 01-701-1115 52.6 3
#> 10 01-701-1118 78.5 2
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
RFCAT = calculate_rfcat()
) %>%
select(USUBJID, EGFR, RFCAT)
#> EGFR variable found and used for the egfr argument.
#> Formula to calculate RFCAT:
#> 1 = Normal Function (>= 90 mL/min)
#> 2 = Mild Impairment (60-89 mL/min)
#> 3 = Moderate Impairment (30-59 mL/min)
#> 4 = Severe Impairment (15-29 mL/min)
#> 5 = End Stage Disease (< 15 mL/min or Dialysis)
#> # A tibble: 254 × 3
#> USUBJID EGFR RFCAT
#> <chr> <dbl> <dbl>
#> 1 01-701-1015 63.2 2
#> 2 01-701-1023 51.0 3
#> 3 01-701-1028 50.0 3
#> 4 01-701-1033 45.7 3
#> 5 01-701-1034 53.8 3
#> 6 01-701-1047 52.7 3
#> 7 01-701-1097 50.4 3
#> 8 01-701-1111 60.1 2
#> 9 01-701-1115 52.6 3
#> 10 01-701-1118 78.5 2
#> # ℹ 244 more rows
calculate_tbilcat
()
Calculate Total Bilirubin Category
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
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
tbil
: Total Bilirubin (mg/dL). Numeric vector. -
tbiluln
: Reference Range Upper Limit (same units as observed values). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
TBILCAT = calculate_tbilcat(
tbil = TBIL,
tbiluln = TBILULN
)
) %>%
select(USUBJID, TBIL, TBILULN, TBILCAT)
#> 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 × 4
#> USUBJID TBIL TBILULN TBILCAT
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 0.6 1.2 0
#> 2 01-701-1023 0.7 1.2 0
#> 3 01-701-1028 1.1 1.2 0
#> 4 01-701-1033 0.8 1.2 0
#> 5 01-701-1034 0.6 1.2 0
#> 6 01-701-1047 0.4 1.2 0
#> 7 01-701-1097 0.4 1.2 0
#> 8 01-701-1111 0.4 1.2 0
#> 9 01-701-1115 0.5 1.2 0
#> 10 01-701-1118 0.7 1.2 0
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
TBILCAT = calculate_tbilcat()
) %>%
select(USUBJID, TBIL, TBILULN, 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 × 4
#> USUBJID TBIL TBILULN TBILCAT
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 0.6 1.2 0
#> 2 01-701-1023 0.7 1.2 0
#> 3 01-701-1028 1.1 1.2 0
#> 4 01-701-1033 0.8 1.2 0
#> 5 01-701-1034 0.6 1.2 0
#> 6 01-701-1047 0.4 1.2 0
#> 7 01-701-1097 0.4 1.2 0
#> 8 01-701-1111 0.4 1.2 0
#> 9 01-701-1115 0.5 1.2 0
#> 10 01-701-1118 0.7 1.2 0
#> # ℹ 244 more rows
calculate_astcat()
Calculate Aspartate Aminotransferase Category
if AST [U/L] <= ULN [U/L] then ASTCAT = 0 if ULN [U/L] < AST [U/L] then ASTCAT = 1
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
ast
: Aspartate Aminotransferase (U/L). Numeric vector. -
astuln
: Reference Range Upper Limit (same units as observed values). Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
ASTCAT = calculate_astcat(
ast = AST,
astuln = ASTULN
)
) %>%
select(USUBJID, AST, ASTULN, ASTCAT)
#> Formula to calculate ASTCAT:
#> if AST [U/L] <= ULN [U/L] then ASTCAT = 0
#> if ULN [U/L] < AST [U/L] then ASTCAT = 1
#> # A tibble: 254 × 4
#> USUBJID AST ASTULN ASTCAT
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 40 34 1
#> 2 01-701-1023 21 36 0
#> 3 01-701-1028 24 36 0
#> 4 01-701-1033 20 36 0
#> 5 01-701-1034 23 34 0
#> 6 01-701-1047 25 34 0
#> 7 01-701-1097 19 36 0
#> 8 01-701-1111 28 34 0
#> 9 01-701-1115 26 36 0
#> 10 01-701-1118 15 36 0
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
ASTCAT = calculate_astcat()
) %>%
select(USUBJID, AST, ASTULN, ASTCAT)
#> AST variable found and used for the ast argument.
#> ASTULN variable found and used for the astuln argument.
#> Formula to calculate ASTCAT:
#> if AST [U/L] <= ULN [U/L] then ASTCAT = 0
#> if ULN [U/L] < AST [U/L] then ASTCAT = 1
#> # A tibble: 254 × 4
#> USUBJID AST ASTULN ASTCAT
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 40 34 1
#> 2 01-701-1023 21 36 0
#> 3 01-701-1028 24 36 0
#> 4 01-701-1033 20 36 0
#> 5 01-701-1034 23 34 0
#> 6 01-701-1047 25 34 0
#> 7 01-701-1097 19 36 0
#> 8 01-701-1111 28 34 0
#> 9 01-701-1115 26 36 0
#> 10 01-701-1118 15 36 0
#> # ℹ 244 more rows
calculate_nciliv()
Calculate NCI Liver Function Group (NCILIV)
if TBILCAT = 0 and ASTCAT = 0 then NCILIV = 0 if TBILCAT = 0 and ASTCAT = 1 then NCILIV = 1 if TBILCAT = 1 then NCILIV = 2 if TBILCAT = 2 then NCILIV = 3 if TBILCAT = 3 then NCILIV = 4
This function returns a numeric vector the same length as its inputs. Following are the inputs:
-
astcat
: Aspartate Aminotransferase Category. Numeric vector. -
tbilcat
: Total Bilirubin Category. Numeric vector.
Examples
All expected variables are provided:
dmcognigen_cov %>%
mutate(
NCILIV = calculate_nciliv(astcat = ASTCAT, tbilcat = TBILCAT)
) %>%
select(USUBJID, ASTCAT, TBILCAT, NCILIV)
#> Formula to calculate NCILIV:
#> if TBILCAT = 0 and ASTCAT = 0 then NCILIV = 0
#> if TBILCAT = 0 and ASTCAT = 1 then NCILIV = 1
#> if TBILCAT = 1 then NCILIV = 2
#> if TBILCAT = 2 then NCILIV = 3
#> if TBILCAT = 3 then NCILIV = 4
#> # A tibble: 254 × 4
#> USUBJID ASTCAT TBILCAT NCILIV
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 1 0 1
#> 2 01-701-1023 0 0 0
#> 3 01-701-1028 0 0 0
#> 4 01-701-1033 0 0 0
#> 5 01-701-1034 0 0 0
#> 6 01-701-1047 0 0 0
#> 7 01-701-1097 0 0 0
#> 8 01-701-1111 0 0 0
#> 9 01-701-1115 0 0 0
#> 10 01-701-1118 0 0 0
#> # ℹ 244 more rows
All or some of expected variables are missing. In this case, the function will try to detect those missing variables from the parent environment:
dmcognigen_cov %>%
mutate(
NCILIV = calculate_nciliv()
) %>%
select(USUBJID, ASTCAT, TBILCAT, NCILIV)
#> ASTCAT variable found and used for the astcat argument.
#> TBILCAT variable found and used for the tbilcat argument.
#> Formula to calculate NCILIV:
#> if TBILCAT = 0 and ASTCAT = 0 then NCILIV = 0
#> if TBILCAT = 0 and ASTCAT = 1 then NCILIV = 1
#> if TBILCAT = 1 then NCILIV = 2
#> if TBILCAT = 2 then NCILIV = 3
#> if TBILCAT = 3 then NCILIV = 4
#> # A tibble: 254 × 4
#> USUBJID ASTCAT TBILCAT NCILIV
#> <chr> <dbl> <dbl> <dbl>
#> 1 01-701-1015 1 0 1
#> 2 01-701-1023 0 0 0
#> 3 01-701-1028 0 0 0
#> 4 01-701-1033 0 0 0
#> 5 01-701-1034 0 0 0
#> 6 01-701-1047 0 0 0
#> 7 01-701-1097 0 0 0
#> 8 01-701-1111 0 0 0
#> 9 01-701-1115 0 0 0
#> 10 01-701-1118 0 0 0
#> # ℹ 244 more rows