Title: | Audit and Research Functions for Transplantation |
---|---|
Description: | A set of vectorised functions to calculate medical equations used in transplantation, focused mainly on transplantation of abdominal organs. These functions include donor and recipient risk indices as used by NHS Blood & Transplant, OPTN/UNOS and Eurotransplant, tools for quantifying HLA mismatches, functions for calculating estimated glomerular filtration rate (eGFR), a function to calculate the APRI (AST to platelet ratio) score used in initial screening of suitability to receive a transplant from a hepatitis C seropositive donor and some biochemical unit converter functions. All functions are designed to work with either US or international units. References for the equations are provided in the vignettes and function documentation. |
Authors: | John Asher [aut, cre] |
Maintainer: | John Asher <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2025-02-12 04:11:01 UTC |
Source: | https://github.com/johnasher/transplantr |
A vectorised function to calculate the APRI score, a predictor of hepatic fibrosis.
apri(ast, plt, ast_uln = 40)
apri(ast, plt, ast_uln = 40)
ast |
numeric vector of serum AST levels in IU/l |
plt |
numeric vector of platelet counts (10^9/l) |
ast_uln |
single number value for lab upper limit of normal for AST levels (default is 40) |
Reference: Lin ZH, Xin YN, Dong QJ, et al. Performance of the aspartate aminotransferase-to-platelet ratio index for the staging of hepatitis C-related fibrosis: an updated meta-analysis. Hepatology 2011; 53:726-736.
numeric vector of APRI scores
apri(ast = 38, plt = 150, ast_uln = 40) # if the lab upper limit of normal is 40, ast_uln can be omitted apri(ast = 160, plt = 75)
apri(ast = 38, plt = 150, ast_uln = 40) # if the lab upper limit of normal is 40, ast_uln can be omitted apri(ast = 160, plt = 75)
A vectorised function to calculate the BAR score to predict patient survival after liver transplantation using a composite of donor and recipient factors.
bar_score(Age, MELD, ReTx, LifeSupport, CIT, DonorAge)
bar_score(Age, MELD, ReTx, LifeSupport, CIT, DonorAge)
Age |
numeric vector of recipient ages in years |
MELD |
numeric vector of MELD scores |
ReTx |
numeric vector of whether retransplant (1 = "yes", 0 = "no") |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 = "yes", 0 = "no") |
CIT |
numeric vector of cold ischaemic time in hours |
DonorAge |
numeric vector of donor ages |
Reference: Dutkowski P, Oberkofler CE, Slankamenac K, et al. Are There Better Guidelines for Allocation in Liver Transplantation? A Novel Score Targeting Justice and Utility in the Model for End-Stage Liver Disease Era. Annals of Surgery 2011; 254:745-753.
numeric vector of BAR scores
bar_score(Age = 63, MELD = 27, ReTx = 0, LifeSupport = 0, CIT = 9.5, DonorAge = 67)
bar_score(Age = 63, MELD = 27, ReTx = 0, LifeSupport = 0, CIT = 9.5, DonorAge = 67)
A vectorised function to convert serum bilirubin levels from mg/dl to µmol/l
bilirubin_to_SI(bili)
bilirubin_to_SI(bili)
bili |
numeric vector of bilirubin levels (mg/dl) |
numeric vector of bilirubin levels in µmol/l
bilirubin_to_SI(bili = 3.1)
bilirubin_to_SI(bili = 3.1)
A vectorised function to convert serum bilirubin levels from µmol/l to mg/dl
bilirubin_to_US(bili)
bilirubin_to_US(bili)
bili |
numeric vector of bilirubin levels (µmol/l) |
numeric vector of bilirubin levels in mg/dl
bilirubin_to_US(bili = 54)
bilirubin_to_US(bili = 54)
A vectorised function to convert blood urea nitrogen (BUN) to urea. The default unit for urea is mmol/l but this can be changed to mg/dl by setting the optional units parameter to "US"
bun_to_urea(BUN, units = "SI")
bun_to_urea(BUN, units = "SI")
BUN |
numeric vector of blood urea nitrogen levels (mg/dl) |
units |
units for urea ("SI" for mmol/l, "US" for mg/dl) |
numeric vector of urea levels
bun_to_urea(8.0)
bun_to_urea(8.0)
A vectorised function to convert a Scottish CHI number to date of birth in POSIXct date format. Note that this function does not always work as not all CHI numbers correspond accurately to date of birth, and any person born before 1920 will appear to be 100 years younger unless the optional cent parameter set to TRUE. Childen born in or after 2020 will appear 100 years older unless the optional paed parameter is set to TRUE. This function requires the stringr package.
chi2dob(chi, paed = FALSE, cent = FALSE)
chi2dob(chi, paed = FALSE, cent = FALSE)
chi |
vector of CHI numbers (as numeric or string) |
paed |
Whether paediatric patient (TRUE/FALSE), either a vector or a single TRUE/FALSE for whole series |
cent |
Whether born before 1920 (TRUE/FALSE), either a vector or a single TRUE/FALSE for whole series |
The paed and cent parameters can either be provided as vectors for each case, for example in a series where there are patients with dates of birth in both the 1910s and 2010s, or alternatively can be set as a single TRUE or FALSE for the whole series.
a vector of POSIXct dates
# as a single numeric chi2dob(1503541234) # as a single character string, for a patient born in 1919 chi2dob("1108191234", cent = TRUE) # as a mixed vector of adults and children, including one born in 1919 chi2dob(chi = c("1503541234", "1108191234", "0510141234"), cent = c(FALSE, TRUE, FALSE))
# as a single numeric chi2dob(1503541234) # as a single character string, for a patient born in 1919 chi2dob("1108191234", cent = TRUE) # as a mixed vector of adults and children, including one born in 1919 chi2dob(chi = c("1503541234", "1108191234", "0510141234"), cent = c(FALSE, TRUE, FALSE))
A vectorised function to calculate estimated glomerular filtration rate using the CKD-EPI equation. By default the equation accepts serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US". To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years.
ckd_epi(creat, age, sex, ethnicity, units = "SI", offset = 0)
ckd_epi(creat, age, sex, ethnicity, units = "SI", offset = 0)
creat |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
age |
numeric vector of age in years (accepts integers or decimals) |
sex |
character vector of sex ("F" for female, "M" for male) |
ethnicity |
character vector of patient ethnicity, one of "black" or "non-black" |
units |
non-vectorised optional parameter for creatinine unit ("SI" for µmol/l (default), "US" for mg/dl) |
offset |
non-vectorised optional numeric parameter for offset in years |
Reference: Levey AS, Stevens LA, Schmid CH, et al. A new equation to estimate glomerular filtration rate. Ann Intern Med 2009; 150(9):604-612.
a numeric vector of eGFR values
ckd_epi(creat = 120, age = 45.2, sex = "M", ethnicity = "non-black") ckd_epi(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black", units = "US")
ckd_epi(creat = 120, age = 45.2, sex = "M", ethnicity = "non-black") ckd_epi(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black", units = "US")
A wrapper function for the ckd_epi() vectorised function to calculate estimated glomerular filtration rate using the CKD-EPI equation, using serum creatinine in mg/dl. To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years.
ckd_epi_US(creat, age, sex, ethnicity, offset = 0)
ckd_epi_US(creat, age, sex, ethnicity, offset = 0)
creat |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
age |
numeric vector of age in years (accepts integers or decimals) |
sex |
character vector of sex ("F" for female, "M" for male) |
ethnicity |
character vector of patient ethnicity, one of "black" or "non-black" |
offset |
non-vectorised optional parameter for offset in years |
Reference: Levey AS, Stevens LA, Schmid CH, et al. A new equation to estimate glomerular filtration rate. Ann Intern Med 2009; 150(9):604-612.
a numeric vector of eGFR values
ckd_epi_US(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black")
ckd_epi_US(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black")
A vectorised function to estimate creatinine clearance using the Cockcroft-Gault equation. By default this uses serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US"
cockcroft(creat, age, sex, weight, units = "SI")
cockcroft(creat, age, sex, weight, units = "SI")
creat |
numeric vector of creatinine levels in µmol/l (or mg/dl if units = "US") |
age |
numeric vector of ages in years |
sex |
character vector of sex ("F" = female, "M" = male) |
weight |
numeric vector of weights in kilograms |
units |
non-vectorised parameter for creatinine units ("SI" for µmol/l (default) or "US" for mg/dl) |
Reference: Cockcroft DW, Gault MH. Prediction of creatinine clearance from serum creatinine. Nephron 1976; 16(1):31-41
numeric vector of creatinine clearances in ml/min
# calculate creatinine clearance using creatinine in µmol/l cockcroft(creat = 88.4, age = 25, sex = "F", weight = 60) # calculate using creatinine in mg/dl cockcroft(creat = 1, age = 25, sex = "F", weight = 60, units = "US")
# calculate creatinine clearance using creatinine in µmol/l cockcroft(creat = 88.4, age = 25, sex = "F", weight = 60) # calculate using creatinine in mg/dl cockcroft(creat = 1, age = 25, sex = "F", weight = 60, units = "US")
A wrapper function for cockcroft(), a vectorised function to estimate creatinine clearance using the Cockcroft-Gault equation, but using creatinine in mg/dl
cockcroft_US(creat, age, sex, weight)
cockcroft_US(creat, age, sex, weight)
creat |
numeric vector of creatinine levels in mg/dl |
age |
numeric vector of ages in years |
sex |
character vector of sex ("F" = female, "M" = male) |
weight |
numeric vector of weights in kilograms |
Reference: Cockcroft DW, Gault MH. Prediction of creatinine clearance from serum creatinine. Nephron 1976; 16(1):31-41
numeric vector of creatinine clearances in ml/min
cockcroft_US(creat = 1, age = 25, sex = "F", weight = 60)
cockcroft_US(creat = 1, age = 25, sex = "F", weight = 60)
A vectorised function to convert serum creatinine levels from mg/dl to µmol/l
creatinine_to_SI(creat)
creatinine_to_SI(creat)
creat |
numeric vector of creatinine levels (mg/dl) |
numeric vector of creatinine levels in µmol/l
creatinine_to_SI(creat = 2.0)
creatinine_to_SI(creat = 2.0)
A vectorised function to convert serum creatinine levels from µmol/l to mg/dl
creatinine_to_US(creat)
creatinine_to_US(creat)
creat |
numeric vector of creatinine levels (µmol/l) |
numeric vector of creatinine levels in mg/dl
creatinine_to_US(creat = 176)
creatinine_to_US(creat = 176)
A vectorised function to calculate EPTS scores as percentiles for norm-related prediction of patient survival after adult renal transplants. This function generates the EPTN scores as percentiles using the most recent lookup table on the OPTN website published in March 2019 and using SRTR data from 2018. The table can be found at https://optn.transplant.hrsa.gov/media/2973/epts_mapping_table_2018.pdf
epts(age, dm, prev_tx, dx)
epts(age, dm, prev_tx, dx)
age |
numeric vector of patient age in years (with decimals) |
dm |
numeric vector of whether patient diabetic (1 = yes, 0 = no) |
prev_tx |
numeric vector of whether patient has a previous solid organ transplant |
dx |
numeric vector of duration of dialysis in years (with decimals) |
This function requires the dplyr package to be installed. References: https://optn.transplant.hrsa.gov/resources/allocation-calculators/epts-calculator/ and https://optn.transplant.hrsa.gov/media/1511/guide_to_calculating_interpreting_epts.pdf
numeric vector of EPTS scores as percentiles
epts(age = 23.5838467, dm = 0, prev_tx = 1, dx = 5.0814511) epts(age = 52.8788501, dm = 0, prev_tx = 0, dx = 0) epts(age = 22.5242984, dm = 1, prev_tx = 1, dx = 6.8747433)
epts(age = 23.5838467, dm = 0, prev_tx = 1, dx = 5.0814511) epts(age = 52.8788501, dm = 0, prev_tx = 0, dx = 0) epts(age = 22.5242984, dm = 1, prev_tx = 1, dx = 6.8747433)
A vectorised function to convert EPTS scores to percentiles for norm-related prediction of patient survival after adult renal transplants. This calculator uses the most recent lookup table published in March 2019 and using SRTR data from 2018 from the OPTN website at https://optn.transplant.hrsa.gov/media/2973/epts_mapping_table_2018.pdf
epts_lookup(raw)
epts_lookup(raw)
raw |
numeric vector of raw EPTS scores |
This function requires the dplyr package to be installed.
References: https://optn.transplant.hrsa.gov/resources/allocation-calculators/epts-calculator/ and https://optn.transplant.hrsa.gov/media/1511/guide_to_calculating_interpreting_epts.pdf
numeric vector of EPTS scores as percentiles
epts_lookup(1.54) # 21
epts_lookup(1.54) # 21
A vectorised function to calculate the Eurotransplant Donor Risk Index for liver transplantation. The ET-DRI is a variant of the American DRI published by Feng et al but adapted to the European population. The American liver DRI is available using the transplantr::liver_dri() function.
et_dri(age, cod, dcd, split, share, cit, ggt, rescue)
et_dri(age, cod, dcd, split, share, cit, ggt, rescue)
age |
numeric vector of patient ages in years |
cod |
character string vector of donor causes of death, one of "trauma", "anoxia", "cva" or "other" |
dcd |
numeric vector of whether DCD (1 = yes, 0 = no) |
split |
numeric vector of whether liver split (1 = yes, 0 = no) |
share |
character string vector of type of sharing, one of "local", regional" or "national" |
cit |
numeric vector of cold ischaemic times in hours |
ggt |
numeric vector of last pre-transplant serum gamma-GT level in IU/l |
rescue |
numeric vector of whether rescue transplant (1 = yes, 0 = no) |
Reference: Braat AE, Blok JJ, Putter H, et al. The Eurotransplant Donor Risk Index in Liver Transplantation: ET-DRI. American Journal of Transplantation 2012; 12:2789–2796.
numeric vector of ET-DRI scores
et_dri(age = 39, cod = "trauma", dcd = 0, split = 0, share = "local", cit = 8, ggt = 50, rescue = 0) # 1.00 et_dri(age = 25, cod = "cva", dcd = 0, split = 0, share = "local", cit = 8, ggt = 50, rescue = 0) # 1.15
et_dri(age = 39, cod = "trauma", dcd = 0, split = 0, share = "local", cit = 8, ggt = 50, rescue = 0) # 1.00 et_dri(age = 25, cod = "cva", dcd = 0, split = 0, share = "local", cit = 8, ggt = 50, rescue = 0) # 1.15
Vectorised function to calculate HLA mismatch level as used in UK national deceased donor kidney matching scheme.
hla_mm_level(a, b, dr)
hla_mm_level(a, b, dr)
a |
numeric vector of HLA A locus mismatches (0-2) |
b |
numeric vector of HLA B locus mismatches (0-2) |
dr |
numeric vector of HLA DR locus mismatches (0-2) |
Mismatches should be provided as numeric vectors of integers with values from 0 to 2 The HLA mismatch level is derived from UK kidney matching policies which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
numeric vector of HLA mismatch levels (1-4)
hla_mm_level(a = 0, b = 1, dr = 1)
hla_mm_level(a = 0, b = 1, dr = 1)
Vectorised function to calculate HLA mismatch levels where the HLA A, B and DR mismatch is recorded as a string rather than as separate numeric values, e.g. "1:0:1" or "101". The function calculates the mismatch level as used in the UK national deceased donor kidney matching scheme. By default, the function assumes a single separator character is used between each of the three numbers in the mismatch; if not, set the sep parameter to FALSE. This function needs the stringr package to be installed.
hla_mm_level_str(mm, sep = TRUE)
hla_mm_level_str(mm, sep = TRUE)
mm |
character string vector of HLA mismatches, e.g. "1:1:0" or "211" |
sep |
logical to indicate whether separator used in the HLA mismatch strings (default TRUE) |
The HLA mismatch level is derived from UK kidney matching policies which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
numeric vector of HLA mismatch levels
# using string of HLA mismatches with colons hla_mm_level_str("1:1:0") # using string of HLA mismatches without separator hla_mm_level_str("211", sep = FALSE)
# using string of HLA mismatches with colons hla_mm_level_str("1:1:0") # using string of HLA mismatches without separator hla_mm_level_str("211", sep = FALSE)
A vectorised function to calculate adult ideal body weight based on height and sex. This function assumes ideal BMI of 21.5 for females and 23 for males.
ibw(height, sex)
ibw(height, sex)
height |
numeric vector of heights in cm |
sex |
character vector of sex ("F" for female or "M" for male) |
numeric vector of ideal body weights in kg
ibw(height = 183, sex = "M")
ibw(height = 183, sex = "M")
Vectorised function to calculate US KDPI percentile as published by OPTN/UNOS. Please note that this function uses creatinine measured in µmol/l by default, but can be changed to mg/dl if the optional units parameter is set to "US".
kdpi(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1, units = "SI")
kdpi(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1, units = "SI")
age |
numeric vector of donor ages in years |
height |
numeric vector of donor heights in cm |
weight |
numeric vector of donor weights in kg |
eth |
character string vector of donor ethnicity, "black" or "non-black" |
htn |
numeric vector of donor hypertension history (1 = yes, 0 = no) |
dm |
numeric vector of donor diabetes history (1 = yes, 0 = no) |
cva |
numeric vector of whether donor death due to CVA (1 = yes, 0 = no) |
creat |
numeric vector of donor serum creatinine (µmol/l) |
hcv |
numeric vector of donor hepatitis C history (1 = yes, 0 = no) |
dcd |
numeric vector of type of donor (1 = DCD, 0 = DBD) |
scaling |
single numeric value for OPTN scaling factor (optional, defaults to 1) |
units |
single string value to indicate creatinine units ("SI" for µmol/l, "US" for mg/dl) |
The KDRI is calculated from KDRI normalised by a scaling factor based on the median KDRI in the previous year. For 2018, this was approximately 1.250609 as is published on the OPTN website. The scaling parameter in this function defaults to 1, so can be left out to calculate the KDPI without scaling.
This function requires the dplyr package to be installed.
Reference: Rao PS, Schaubel DE, Guidinger MK, et al. A Comprehensive Risk Quantification Score for Deceased Donor Kidneys: The Kidney Donor Risk Index. Transplantation 2009; 88:231-236.
numeric vector of US KDRI values
# with creatinine in µmol/l (units = "SI" can be omitted) kdpi(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 120, hcv = 0, dcd = 0, scaling = 1.250609, units = "SI") # with creatinine in mg/dl kdpi(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609, units = "US")
# with creatinine in µmol/l (units = "SI" can be omitted) kdpi(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 120, hcv = 0, dcd = 0, scaling = 1.250609, units = "SI") # with creatinine in mg/dl kdpi(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609, units = "US")
A vectorised function to convert kdri KDRI scores to KDPI percentiles. If the OPTN scaling factor was not used when calculating the KDRI, it can be set here using the optional scaling parameter which uses a default value of 1 (for no scaling).
kdpi_lookup(kdri, scaling = 1)
kdpi_lookup(kdri, scaling = 1)
kdri |
numeric vector of KDRI values |
scaling |
optional parameter for scaling factor (default is 1) |
This function requires the dplyr package to be installed.
numeric vector of KDPI percentiles
# if scaling factor was used when calculating KDRI kdpi_lookup(1.25) # if scaling factor for 2018 needs to be applied kdpi_lookup(1.25, scaling = 1.2506957544151)
# if scaling factor was used when calculating KDRI kdpi_lookup(1.25) # if scaling factor for 2018 needs to be applied kdpi_lookup(1.25, scaling = 1.2506957544151)
Wrapper function for the kdpi() vectorised function to calculate US KDPI percentile as published by OPTN/UNOS, using creatinine measured in mg/dl (please use the kdpi() function for µmol/l).
kdpi_US(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1)
kdpi_US(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1)
age |
numeric vector of donor ages in years |
height |
numeric vector of donor heights in cm |
weight |
numeric vector of donor weights in kg |
eth |
character string vector of donor ethnicity, "black" or "non-black" |
htn |
numeric vector of donor hypertension history (1 = yes, 0 = no) |
dm |
numeric vector of donor diabetes history (1 = yes, 0 = no) |
cva |
numeric vector of whether donor death due to CVA (1 = yes, 0 = no) |
creat |
numeric vector of donor serum creatinine (µmol/l) |
hcv |
numeric vector of donor hepatitis C history (1 = yes, 0 = no) |
dcd |
numeric vector of type of donor (1 = DCD, 0 = DBD) |
scaling |
single numeric value for OPTN scaling factor (optional, defaults to 1) |
The KDRI is calculated from KDRI normalised by a scaling factor based on the median KDRI in the previous year. For 2018, this was approximately 1.250609 as is published on the OPTN website. The scaling parameter in this function defaults to 1, so can be left out to calculate the KDPI without scaling.
This function requires the dplyr package to be installed.
Reference: Rao PS, Schaubel DE, Guidinger MK, et al. A Comprehensive Risk Quantification Score for Deceased Donor Kidneys: The Kidney Donor Risk Index. Transplantation 2009; 88:231-236.
numeric vector of US KDRI values
# with creatinine in mg/dl kdpi_US(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609)
# with creatinine in mg/dl kdpi_US(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609)
A simulated dataset of kidney donors to illustrate the KDRI vignette
kidney.donors
kidney.donors
A data frame with 4 rows and 7 variables:
donor age in years
donor height in cm
donor hypertension
donor sex
donor CMV status
donor GFR
donor hospital stay in days
...
A vectorised function to calculate the Liver Donor Risk Index as published by Feng and others.
liver_dri(age, cod, eth, dcd, split, share, cit, height)
liver_dri(age, cod, eth, dcd, split, share, cit, height)
age |
numeric vector of patient ages in years |
cod |
character string vector of donor causes of death, one of "trauma", "anoxia", "cva" or "other" |
eth |
character string vector of ethnicity, one of "black", "white" or "other" |
dcd |
numeric vector of whether DCD (1 = yes, 0 = no) |
split |
numeric vector of whether liver split (1 = yes, 0 = no) |
share |
character string vector of type of sharing, one of "regional" or "national" |
cit |
numeric vector of cold ischaemic times in hours |
height |
numeric vector of patient heights in cm |
Reference: Feng S, Goodrich NP, Bragg-Gresham JL et al. Characteristics Associated with Liver Graft Failre: The Concept of a Donor Risk Index. American Journal of Transplantation 2006; 6:783-790.
numeric vector of liver DRI values
liver_dri(age = 25, cod = "trauma", eth = "white", dcd = 0, split = 0, share = "local", cit = 8, height = 170) # 1.00 liver_dri(age = 64, cod = "cva", eth = "white", dcd = 0, split = 0, share = "local", cit = 14, height = 170) # 1.88
liver_dri(age = 25, cod = "trauma", eth = "white", dcd = 0, split = 0, share = "local", cit = 8, height = 170) # 1.00 liver_dri(age = 64, cod = "cva", eth = "white", dcd = 0, split = 0, share = "local", cit = 14, height = 170) # 1.88
A simulated dataset of liver patient characteristics for the MELD vignette
liver.pts
liver.pts
A data frame with 4 rows and 6 variables:
patient age in years
Patient INR
Patient serum bilirubin in µmol/l
serum serum creatinine in µmol/l
Patient serum sodium in mmol/l
Whether patient dialysed (1 = yes, 0 = no)
...
A vectorised function to calculate estimated glomerular filtration rate using the abbreviated (four variable) MDRD equation. By default the equation accepts serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US". To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years.
mdrd(creat, age, sex, ethnicity, units = "SI", offset = 0)
mdrd(creat, age, sex, ethnicity, units = "SI", offset = 0)
creat |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
age |
numeric vector of age in years (accepts integers or decimals) |
sex |
character vector of sex ("F" for female, "M" for male) |
ethnicity |
character vector of patient ethnicity, one of "black" or "non-black" |
units |
non-vectorised optional parameter for creatinine unit ("SI" for µmol/l (default), "US" for mg/dl) |
offset |
non-vectorised optional parameter for offset in years |
Reference: Levey AS, Greene T, Kusek JW, et al. A simplified equation to predict glomerular filtration rate from serum creatinine. J Am Soc Nephrol 2000; 11:A0828.
a numeric vector of eGFR values
mdrd(creat = 120, age = 45.2, sex = "M", ethnicity = "non-black") mdrd(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black", units = "US")
mdrd(creat = 120, age = 45.2, sex = "M", ethnicity = "non-black") mdrd(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black", units = "US")
A wrapper for the mdrd4v() vectorised function to calculate estimated glomerular filtration rate using the abbreviated (four variable) MDRD equation, but using serum creatinine in mg/dl. To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years.
mdrd_US(creat, age, sex, ethnicity, offset = 0)
mdrd_US(creat, age, sex, ethnicity, offset = 0)
creat |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
age |
numeric vector of age in years (accepts integers or decimals) |
sex |
character vector of sex ("F" for female, "M" for male) |
ethnicity |
character vector of patient ethnicity, one of "black" or "non-black" |
offset |
non-vectorised optional parameter for offset in years |
Reference: Levey AS, Greene T, Kusek JW, et al. A simplified equation to predict glomerular filtration rate from serum creatinine. J Am Soc Nephrol 2000; 11:A0828.
a numeric vector of eGFR values
mdrd_US(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black")
mdrd_US(creat = 1.5, age = 64.3, sex = "F", ethnicity = "black")
A vectorised function to calculate the MELD score using µmol/l for bilirubin and creatinine. The units can be changed to mg/dl by setting the optional units parameter to "US". If the patient is on CVVH or has been dialysed at least twice in the same week, the dialysis argument should be set to 1, which changes the creatinine level used in the formula to 4mg/dl (353µmol/l). Following UNOS guidelines, the values for INR as well bilirubin and creatinine (in mg/dl) are set to a minimum value of 1 if less than 1.0
meld(INR, bili, creat, dialysis, units = "SI")
meld(INR, bili, creat, dialysis, units = "SI")
INR |
numeric vector of INR |
bili |
numeric vector of bilirubin (µmol/l) |
creat |
numeric vector of creatinine (µmol/l) |
dialysis |
numeric vector of whether on dialysis/CVVH (1 = yes, 2 = no) |
units |
Units for bilirubin and creatinine ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Kamath PS, Wiesner RH, Malinchoc M, et al. A model to predict survival in patients with end-stage liver disease. Hepatology 2001; 33:464-470.
MELD score
meld(INR = 2.0, bili = 54, creat = 170, dialysis = 0) meld(INR = 2.0, bili = 3.1, creat = 1.9, dialysis = 0, units = "US")
meld(INR = 2.0, bili = 54, creat = 170, dialysis = 0) meld(INR = 2.0, bili = 3.1, creat = 1.9, dialysis = 0, units = "US")
A vectorised function to calculate the MELD-Na score, a variant of the MELD score incorporating serum sodium levels. By default, bilirubin and creatinine are in µmol/l but this can be changed to mg/dl by setting the optional units parameter to "US".
meld_na(INR, bili, creat, Na, dialysis, units = "SI")
meld_na(INR, bili, creat, Na, dialysis, units = "SI")
INR |
numeric vector of INR |
bili |
numeric vector of bilirubin (µmol/l) |
creat |
numeric vector of creatinine (µmol/l) |
Na |
numeric vector of sodium (mmol/l) |
dialysis |
whether on dialysis/CVVH (1 = yes, 0 = no) |
units |
Units for bilirubin and creatinine ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Biggins SW, Kim WR, Terrault NA, et al. Evidence-based incorporation of serum sodium concentration into MELD. Gastroenterology 2006; 130(6):1652-60.
numeric vector of MELD-Na scores
meld_na(INR = 1.8, bili = 34, creat = 176, Na = 131, dialysis = 0) meld_na(INR = 1.8, bili = 2, creat = 2, Na = 131, dialysis = 0, units = "US")
meld_na(INR = 1.8, bili = 34, creat = 176, Na = 131, dialysis = 0) meld_na(INR = 1.8, bili = 2, creat = 2, Na = 131, dialysis = 0, units = "US")
A wrapper for meld_na(), a vectorised function to calculate the MELD-Na score, a variant of the MELD score incorporating serum sodium levels. In this wrapper function, bilirubin and creatinine are in mg/dl.
meld_na_US(INR, bili, creat, Na, dialysis)
meld_na_US(INR, bili, creat, Na, dialysis)
INR |
numeric vector of INR |
bili |
numeric vector of serum bilirubin (mg/dl) |
creat |
numeric vector of serum creatinine (mg/dl) |
Na |
numeric vector of serum sodium (mmol/l) |
dialysis |
whether on dialysis/CVVH (1 = yes, 0 = no) |
Reference: Biggins SW, Kim WR, Terrault NA, et al. Evidence-based incorporation of serum sodium concentration into MELD. Gastroenterology 2006; 130(6):1652-60.
numeric vector of MELD-Na scores
meld_na_US(INR = 1.8, bili = 2, creat = 2, Na = 131, dialysis = 0)
meld_na_US(INR = 1.8, bili = 2, creat = 2, Na = 131, dialysis = 0)
A wrapper for the vectorised function meld() to calculate the MELD score, but using mg/dl for bilirubin and creatinine. If the patient is on CVVH or has been dialysed at least twice in the same week, the dialysis argument should be set to 1, which changes the creatinine level used in the formula to 4mg/dl. Following UNOS guidelines, the values for INR as well bilirubin and creatinine are set to a minimum value of 1 if less than 1.0
meld_US(INR, bili, creat, dialysis)
meld_US(INR, bili, creat, dialysis)
INR |
numeric vector ofINR |
bili |
numeric vector of bilirubin in mg/dl |
creat |
numeric vector of creatinine in mg/dl |
dialysis |
numeric vector of whether on dialysis/CVVH (1 = yes, 0 = no) |
Reference: Kamath PS, Wiesner RH, Malinchoc M, et al. A model to predict survival in patients with end-stage liver disease. Hepatology 2001; 33:464-470.
MELD score
meld_US(INR = 2.0, bili = 2.3, creat = 1.9, dialysis = 1)
meld_US(INR = 2.0, bili = 2.3, creat = 1.9, dialysis = 1)
A simulated dataset of HLA mismatches
mismatches
mismatches
A data frame with 4 rows and 5 variables:
HLA A mismatch
HLA B mismatch
HLA DR mismatch
HLA mismatch as string
HLA mismatch as string with separators
...
A vectorised function to calculate eGFR using the Nankivell formula. By default the equation accepts serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US". The Urea parameter is serum urea in mmol/l, but if the units parameter is set to "US", Blood Urea Nitrogen (BUN) in mg/dl is used instead. It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
nankivell(SCr, Urea, Weight, Height, Sex, Units = "SI")
nankivell(SCr, Urea, Weight, Height, Sex, Units = "SI")
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Urea |
numeric vector of serum urea in mmol/l (or BUN in mg/dl if units = "US") |
Weight |
numeric vector of patient weights in kilograms |
Height |
numeric vector of patient heights in centimetres |
Sex |
character vector of sex ("F" for female, "M" for male) |
Units |
non-vectorised optional parameter for creatinine and urea/BUN units ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Nankivell BJ, Gruenwald SM, Allen RD, Chapman JR: Predicting glomerular filtration rate after renal transplantation. Transplantation 1995; 59:1683-89.
a numeric vector of eGFR values
nankivell(SCr = 118, Urea = 13.4, Weight = 65, Height = 172, Sex = "M") # 44.55
nankivell(SCr = 118, Urea = 13.4, Weight = 65, Height = 172, Sex = "M") # 44.55
A vectorised function to calculate the eGFR using the Nankivell-SPK formula. By default the equation accepts serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US". To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years. It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
nankivell_spk(SCr, Age, Sex, Weight, Height, Units = "SI", Offset = 0)
nankivell_spk(SCr, Age, Sex, Weight, Height, Units = "SI", Offset = 0)
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Age |
numeric vector of patient ages in years |
Sex |
character vector of sex ("F" for female, "M" for male) |
Weight |
numeric vector of patient weights in kilograms |
Height |
numeric vector of patient heights in centimetres |
Units |
non-vectorised optional parameter for creatinine and urea/BUN units ("SI" for µmol/l (default), "US" for mg/dl) |
Offset |
non-vectorised optional numeric parameter for offset in years |
Reference: Nankivell BJ, Chapman JR, Allen RD: Predicting glomerular filtration rate after simultaneous pancreas and kidney transplantation. Clin Transplant 1995; 9(2): 129-134
numeric vector of eGFR values
nankivell_spk(SCr = 118, Age = 74, Sex = "M", Weight = 172, Height = 172) # 48.8
nankivell_spk(SCr = 118, Age = 74, Sex = "M", Weight = 172, Height = 172) # 48.8
A wrapper function for the nankivell_spk() vectorised function to calculate the eGFR using the Nankivell-SPK formula using serum creatinine in mg/dl. To allow for serial measurements over time, such as for transplant follow-up data, there is an optional offset = n parameter which increases the age value used in the equation by n years. It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
nankivell_spk_US(SCr, Age, Sex, Weight, Height, Offset = 0)
nankivell_spk_US(SCr, Age, Sex, Weight, Height, Offset = 0)
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Age |
numeric vector of patient ages in years |
Sex |
character vector of sex ("F" for female, "M" for male) |
Weight |
numeric vector of patient weights in kilograms |
Height |
numeric vector of patient heights in metres |
Offset |
non-vectorised optional numeric parameter for offset in years |
Reference: Nankivell BJ, Chapman JR, Allen RD: Predicting glomerular filtration rate after simultaneous pancreas and kidney transplantation. Clin Transplant 1995; 9(2): 129-134
numeric vector of eGFR values
nankivell_spk_US(SCr = 1.33, Age = 74, Sex = "M", Weight = 172, Height = 172) # 49.0
nankivell_spk_US(SCr = 1.33, Age = 74, Sex = "M", Weight = 172, Height = 172) # 49.0
A wrapper function for the nankivell() vectorised function to calculate eGFR using the Nankivell formula, but using creatinine and BUN in mg/dl rather than international units. It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
nankivell_US(SCr, Urea, Weight, Height, Sex)
nankivell_US(SCr, Urea, Weight, Height, Sex)
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Urea |
numeric vector of serum urea in mmol/l (or BUN in mg/dl if units = "US") |
Weight |
numeric vector of patient weights in kilograms |
Height |
numeric vector of patient heights in centimetres |
Sex |
character vector of sex ("F" for female, "M" for male) |
Reference: Nankivell BJ, Gruenwald SM, Allen RD, Chapman JR: Predicting glomerular filtration rate after renal transplantation. Transplantation 1995; 59:1683-89.
a numeric vector of eGFR values
nankivell_US(SCr = 1.33, Urea = 13.4, Weight = 65, Height = 172, Sex = "M") # 44.55
nankivell_US(SCr = 1.33, Urea = 13.4, Weight = 65, Height = 172, Sex = "M") # 44.55
A vectorised function to calculate the P-PASS pre-procurement pancreas allocation suitability score used in the Eurotransplant area. The score are between 9 and 27, and in a study published by Vinkers et al. in 2008, pancreata with P-PASS score less than 17 were three times more likely to be transplanted than those with scores of 17 or more.
p_pass(age, bmi, icu, c.arr, Na, amylase = NULL, lipase = NULL, norad, dopam)
p_pass(age, bmi, icu, c.arr, Na, amylase = NULL, lipase = NULL, norad, dopam)
age |
numeric vector of donor ages in years |
bmi |
numeric vector of donor body mass index (BMI) |
icu |
numeric vector of length of donor ICU stay in days |
c.arr |
numeric vector for duration of cardiac arrest (use 0 if no cardiac arrest) |
Na |
numeric vector of donor serum sodium in mmmol/l |
amylase |
numeric vector of donor serum amylase in IU/l (0 if not available) |
lipase |
numeric vector of donor serum lipase in IU/l (0 if not available) |
norad |
numeric vector of noradrenaline (0 if not used) |
dopam |
numeric vector of dopamine or dobutamine (0 if not used) |
At least one of amylase or lipase is needed for each case, but this function can take datasets with a mixture of amylase and lipase levels and will allocate points based on the higher points for cases when both are provided.
Reference: Vinkers MT, Rahmel AO, Slot MC, et al. How to recognize a suitable pancreas donor: a Eurotransplant study of preprocurement factors. Transplant Proc 2008; 40(5):1275-8.
numeric vector of P-PASS scores
# as a single case p_pass(age = 25, bmi = 19, icu = 0, c.arr = 0, Na = 135, amylase = 101, lipase = 120, norad = 0, dopam = 0) # 9 # as a vector with mixed amylase and lipase availability p_pass(age = c(25, 31, 45), bmi = c(18, 22, 35), icu = c(2, 5, 10), c.arr = c(0, 4, 10), Na = c(135, 157, 164), amylase = c(120, NA, 400), lipase = c(155, 170, NA), norad = c(0, 0.02, 0.06), dopam = c(0, 5, 11)) # 9, 19, 25 # as a vector with all lipase values missing p_pass(age = c(25, 31, 45), bmi = c(18, 22, 35), icu = c(2, 5, 10), c.arr = c(0, 4, 10), Na = c(135, 157, 164), amylase = c(120, 145, 400), lipase = c(NA, NA, NA), norad = c(0, 0.02, 0.06), dopam = c(0, 5, 11)) # 9, 19, 25
# as a single case p_pass(age = 25, bmi = 19, icu = 0, c.arr = 0, Na = 135, amylase = 101, lipase = 120, norad = 0, dopam = 0) # 9 # as a vector with mixed amylase and lipase availability p_pass(age = c(25, 31, 45), bmi = c(18, 22, 35), icu = c(2, 5, 10), c.arr = c(0, 4, 10), Na = c(135, 157, 164), amylase = c(120, NA, 400), lipase = c(155, 170, NA), norad = c(0, 0.02, 0.06), dopam = c(0, 5, 11)) # 9, 19, 25 # as a vector with all lipase values missing p_pass(age = c(25, 31, 45), bmi = c(18, 22, 35), icu = c(2, 5, 10), c.arr = c(0, 4, 10), Na = c(135, 157, 164), amylase = c(120, 145, 400), lipase = c(NA, NA, NA), norad = c(0, 0.02, 0.06), dopam = c(0, 5, 11)) # 9, 19, 25
A vectorised function to calculate the pre-procurement component of the SOFT score used to predict patient survival after liver transplantation. The function needs the MELD score as one of its inputs - this is available using the transplantr::meld() function. The units for albumin are g/l but this is changed to g/dl if the optional Units parameter is set to "US"
p_soft(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, Units = "SI")
p_soft(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, Units = "SI")
Age |
numeric vector of patient ages in years |
BMI |
numeric vector of patient BMI in kg/m2 |
PrevTx |
numeric vector of number of previous transplants |
AbdoSurg |
numeric vector of whether previous abdominal surgery (1 = "yes", 0 = "no") |
Albumin |
numeric vector of serum albumin in g/l |
Dx |
numeric vector of whether on dialysis before transplant (1 = "yes", 0 = "no") |
ICU |
numeric vector of whether patients in intensive care unit before transplant (1 = "yes", 0 = "no") |
Admitted |
numeric vector of whether admitted to hospital pre-transplant (1 = "yes", 0 = "no") |
MELD |
numeric vector of MELD scores |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 = "yes", 0 = "no") |
Encephalopathy |
numeric vector of whether encephalopathy present (1 = "yes", 0 = "no") |
PVThrombosis |
numeric vector of whether portal vein thrombosis (1 = "yes", 0 = "no") |
Ascites |
numeric vector of whether ascites pre-transplant (1 = "yes", 0 = "no") |
Units |
optional scalar for albumin units (one of "SI" for g/l, "US" for g/dl) |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of P-SOFT scores
p_soft(Age = 65, BMI = 36, PrevTx = 2, AbdoSurg = 1, Albumin = 29, Dx = 0, ICU = 0, Admitted = 1, MELD = 32, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 1, Ascites = 1) # 37
p_soft(Age = 65, BMI = 36, PrevTx = 2, AbdoSurg = 1, Albumin = 29, Dx = 0, ICU = 0, Admitted = 1, MELD = 32, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 1, Ascites = 1) # 37
A wrapper for the p_soft() vectorised function to calculate the pre-procurement component of the SOFT score used to predict patient survival after liver transplantation. The function needs the MELD score as one of its inputs - this is available using the transplantr::meld() function. The units for albumin are g/dl (rather than g/l in p_soft() function)
p_soft_US(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites)
p_soft_US(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites)
Age |
numeric vector of patient ages in years |
BMI |
numeric vector of patient BMI in kg/m2 |
PrevTx |
numeric vector of number of previous transplants |
AbdoSurg |
numeric vector of whether previous abdominal surgery (1 = "yes", 0 = "no") |
Albumin |
numeric vector of serum albumin in g/dl |
Dx |
numeric vector of whether on dialysis before transplant (1 = "yes", 0 = "no") |
ICU |
numeric vector of whether patients in intensive care unit before transplant (1 = "yes", 0 = "no") |
Admitted |
numeric vector of whether admitted to hospital pre-transplant (1 = "yes", 0 = "no") |
MELD |
numeric vector of MELD scores |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 = "yes", 0 = "no") |
Encephalopathy |
numeric vector of whether encephalopathy present (1 = "yes", 0 = "no") |
PVThrombosis |
numeric vector of whether portal vein thrombosis (1 = "yes", 0 = "no") |
Ascites |
numeric vector of whether ascites pre-transplant (1 = "yes", 0 = "no") |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of P-SOFT scores
p_soft_US(Age = 65, BMI = 36, PrevTx = 2, AbdoSurg = 1, Albumin = 2.9, Dx = 0, ICU = 0, Admitted = 1, MELD = 32, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 1, Ascites = 1) # 37
p_soft_US(Age = 65, BMI = 36, PrevTx = 2, AbdoSurg = 1, Albumin = 2.9, Dx = 0, ICU = 0, Admitted = 1, MELD = 32, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 1, Ascites = 1) # 37
A vectorised function to calculate the Pancreas Donor Risk Index as published by Axelrod et al. By default, the serum creatinine is used in mcmmol/l but this can be changed to mg/dl by setting the optional units parameter to "US"
pdri(age, sex, creat, eth, bmi, height, cva, cit, dcd, intent = c("SPK", "PAK", "Other"), units = "SI")
pdri(age, sex, creat, eth, bmi, height, cva, cit, dcd, intent = c("SPK", "PAK", "Other"), units = "SI")
age |
numeric vector of ages in years |
sex |
character vector of patient sex ("F" for female, "M" for male) |
creat |
numeric vector of serum creatinine (µmol/l by default) |
eth |
character vector of ethnicity, one of "asian", "black" or "other" in each case |
bmi |
numeric vector of body mass index (BMI) |
height |
numeric vector of heights in centimetres |
cva |
numeric vector of whether CVA is cause of death (1 = yes, 0 = no) |
cit |
numeric vector of cold ischaemic times in hours |
dcd |
numeric vector of whether donor after circulatory death (1 = DCD, 0 = DBD) |
intent |
character vector of implant intent, "PAK" for pancreas after kidney or "other" |
units |
single character string for creatinine units: one of "SI" (for µmol/l) or "US" (for mg/dl) |
Reference: Axelrod DA, Sung RS, Meyer KH, et al. Systematic evaluation of pancreas allograft quality, outcomes and geographic variation in utilization. Am J Transplant 2010; 10(4):837-45.
numeric vector of pancreas donor risk index values
pdri(age = 28, sex = "M", creat = 1.0, eth = "other", bmi = 24, height = 173, cva = 0, cit = 12, dcd = 0, units = "US") # 1.00 pdri(age = 45, sex = "M", creat = 88.4, eth = "other", bmi = 24, height = 173, cva = 0, cit = 12, dcd = 0, units = "SI") # 1.56
pdri(age = 28, sex = "M", creat = 1.0, eth = "other", bmi = 24, height = 173, cva = 0, cit = 12, dcd = 0, units = "US") # 1.00 pdri(age = 45, sex = "M", creat = 88.4, eth = "other", bmi = 24, height = 173, cva = 0, cit = 12, dcd = 0, units = "SI") # 1.56
A vectorised function to calculate the Pedi-SOFT score used to predict survival after liver transplantation in children.
pedi_soft(CTVG, Weight, Dx, LifeSupport, PrevTx)
pedi_soft(CTVG, Weight, Dx, LifeSupport, PrevTx)
CTVG |
numeric vector of whether cadaveric technical variant graft (1 for "yes", 0 for "no") |
Weight |
numeric vector of recipient weight in kg |
Dx |
numeric vector of whether on dialysis or creatinine clearance under 30 (1 for "yes", 0 for "no") |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 for "yes", 0 for "no") |
PrevTx |
numeric vector of number of previous liver transplants |
Reference: Rana A, Pallister ZS, Guiteau JJ, et al. Survival Outcomes Following Pediatric Liver Transpantation (Pedi-SOFT) Score: A Novel Predictive Index. American Journal of Transplantation 2015; 15:1855-1863.
numeric vector of Pedi-SOFT scores
pedi_soft(CTVG = 1, Weight = 10, Dx = 0, LifeSupport = 0, PrevTx = 0) # 4
pedi_soft(CTVG = 1, Weight = 10, Dx = 0, LifeSupport = 0, PrevTx = 0) # 4
A vectorised function to generate a PELD score for paediatric liver transplant candidates. The default unit for bilirubin is µmol/l and albumin in g/l, but these can be changed to mg/dl and g/dl respectively by setting the optional units parameter to "US".
peld(INR, bili, albumin, listing_age, growth_failure, units = "SI")
peld(INR, bili, albumin, listing_age, growth_failure, units = "SI")
INR |
INR |
bili |
serum biliruin (µmol/l) |
albumin |
serum albumin (g/l) |
listing_age |
age at the time of listing (years; integer or decimal) |
growth_failure |
whether there is growth failure (1 = yes, 0 = no) |
units |
units used for bilirubin ("SI" for µmol/l (default), "US" for mg/dl) |
Some labs report albumin in g/dl rather than the g/l used in this function. If units are set to "US" then g/dl is assumed and albumin should be divided by 10 if the lab reports are in g/l. If using SI units, take care to multiply the lab albumin by 10 if the lab output is in g/dl.
Reference: McDiarmid SV, Anand R, Lindblad AS, et. al. Development of a pediatric end-stage liver disease score to predict poor outcome in children awaiting liver transplantation. Transplantation 2002; 74(2):173-81.
numeric vector of PELD scores
peld(INR = 2, bili = 54, albumin = 25, listing_age = 2, growth_failure = 1) peld(INR = 2, bili = 3.1, albumin = 25, listing_age = 2, growth_failure = 1, units = "US")
peld(INR = 2, bili = 54, albumin = 25, listing_age = 2, growth_failure = 1) peld(INR = 2, bili = 3.1, albumin = 25, listing_age = 2, growth_failure = 1, units = "US")
A wrapper for peld(), a vectorised function to generate a PELD score for paediatric liver transplant candidates, using mg/dl as the unit for the serum bilirubin level.
peld_US(INR, bili, albumin, listing_age, growth_failure)
peld_US(INR, bili, albumin, listing_age, growth_failure)
INR |
numeric vector of INR |
bili |
numeric vector of serum biliruin (mg/dl) |
albumin |
numeric vector of serum albumin (g/dl) |
listing_age |
numeric vector of age at the time of listing (years) |
growth_failure |
numeric vector of whether there is growth failure (1 = yes, 0 = no) |
Reference: McDiarmid SV, Anand R, Lindblad AS, et. al. Development of a pediatric end-stage liver disease score to predict poor outcome in children awaiting liver transplantation. Transplantation 2002; 74(2):173-81.
numeric vector of PELD scores
peld_US(INR = 2, bili = 3.1, albumin = 2.5, listing_age = 2, growth_failure = 1)
peld_US(INR = 2, bili = 3.1, albumin = 2.5, listing_age = 2, growth_failure = 1)
A vectorised function to calculate raw EPTS scores for norm-related prediction of patient survival after adult renal transplants. This function generates the raw EPTS scores which can be converted to percentiles using the lookup table on the OPTN website at https://optn.transplant.hrsa.gov/media/2973/epts_mapping_table_2018.pdf
raw_epts(age, dm, prev_tx, dx)
raw_epts(age, dm, prev_tx, dx)
age |
numeric vector of patient age in years (with decimals) |
dm |
numeric vector of whether patient diabetic (1 = yes, 0 = no) |
prev_tx |
numeric vector of whether patient has a previous solid organ transplant |
dx |
numeric vector of duration of dialysis in years (with decimals) |
References: https://optn.transplant.hrsa.gov/resources/allocation-calculators/epts-calculator/ and https://optn.transplant.hrsa.gov/media/1511/guide_to_calculating_interpreting_epts.pdf
numeric vector of raw EPTS scores
raw_epts(age = 23.5838467, dm = 0, prev_tx = 1, dx = 5.0814511) # 0.9666517 raw_epts(age = 52.8788501, dm = 0, prev_tx = 0, dx = 0) # 1.440306 raw_epts(age = 22.5242984, dm = 1, prev_tx = 1, dx = 6.8747433) # 1.868751
raw_epts(age = 23.5838467, dm = 0, prev_tx = 1, dx = 5.0814511) # 0.9666517 raw_epts(age = 52.8788501, dm = 0, prev_tx = 0, dx = 0) # 1.440306 raw_epts(age = 22.5242984, dm = 1, prev_tx = 1, dx = 6.8747433) # 1.868751
A simulated dataset of patient characteristics and creatinine levels
results
results
A data frame with 4 rows and 6 variables:
serum creatinine in µmol/l
patient age in years
Patient sex, M or F
Patient ethnicity
Patient weight in kg
Patient height in cm
...
A simulated dataset of patient characteristics and creatinine levels
results_US
results_US
A data frame with 4 rows and 6 variables:
serum creatinine in mg/dl
Patient sex, M or F
patient age in years
Patient ethnicity
Patient weight in kg
Patient height in cm
...
A vectorised formula to calculate estimate glomerular filtration rate in children using the bedside Schwartz formula. By default this uses serum creatinine in µmol/l but this can be changed to mg/dl by setting the optional units parameter to "US".
schwartz(creat, height, units = "SI")
schwartz(creat, height, units = "SI")
creat |
numeric vector of creatinine levels in µmol/l (or mg/dl if units = "US") |
height |
numeric vector of heights in cm |
units |
non-vectorised optional parameter for creatinine unit ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Schwartz GJ, Munoz A, Schneider MF et al. New equations to estimate GFR in children with CKD. J Am Soc Nephrol 2009; 20(3):629-637.
numeric vector of eGFR values
# calculate using creatinine in µmol/l schwartz(creat = 64, height = 101) # calculate using mg/dl schwartz(creat = 0.7, height = 101, units = "US")
# calculate using creatinine in µmol/l schwartz(creat = 64, height = 101) # calculate using mg/dl schwartz(creat = 0.7, height = 101, units = "US")
A wrapper function for the schwartz() vectorised formula to calculate estimate glomerular filtration rate in children using the bedside Schwartz formula, using serum creatinine in mg/dl. Use the schwartz() function instead for µmol/l.
schwartz_US(creat, height)
schwartz_US(creat, height)
creat |
numeric vector of creatinine levels in µmol/l (or mg/dl if units = "US") |
height |
numeric vector of heights in cm |
Reference: Schwartz GJ, Munoz A, Schneider MF et al. New equations to estimate GFR in children with CKD. J Am Soc Nephrol 2009; 20(3):629-637.
numeric vector of eGFR values
# calculate using creatinine in -mg/dl schwartz_US(creat = 0.7, height = 101)
# calculate using creatinine in -mg/dl schwartz_US(creat = 0.7, height = 101)
A simulated dataset of patient characteristics and creatinine levels
serial.results
serial.results
A data frame with 4 rows and 6 variables:
patient age in years
Patient sex, M or F
Patient ethnicity
serum creatinine at 1 year, in µmol/l
serum creatinine at 5 years, in µmol/l
...
A vectorised function to calculate SOFT Scores for predicting patient survival after liver transplantation The units for donor serum creatinine are in µmol/l and recipient serum albumin in g/l but they can be changed to mg/dl and g/dl respectively by setting the Units parameter to "US".
soft(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT, Units = "SI")
soft(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT, Units = "SI")
Age |
numeric vector of patient ages in years |
BMI |
numeric vector of patient BMI in kg/m2 |
PrevTx |
numeric vector of number of previous transplants |
AbdoSurg |
numeric vector of whether previous abdominal surgery (1 = "yes", 0 = "no") |
Albumin |
numeric vector of serum albumin in g/l |
Dx |
numeric vector of whether on dialysis before transplant (1 = "yes", 0 = "no") |
ICU |
numeric vector of whether patients in intensive care unit before transplant (1 = "yes", 0 = "no") |
Admitted |
numeric vector of whether admitted to hospital pre-transplant (1 = "yes", 0 = "no") |
MELD |
numeric vector of MELD scores |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 = "yes", 0 = "no") |
Encephalopathy |
numeric vector of whether encephalopathy present (1 = "yes", 0 = "no") |
PVThrombosis |
numeric vector of whether portal vein thrombosis (1 = "yes", 0 = "no") |
Ascites |
numeric vector of whether ascites pre-transplant (1 = "yes", 0 = "no") |
PortalBleed |
numeric vector of whether portal bleeding in 48 hours pre-transplant (1 = "yes", 0 = "no") |
DonorAge |
numeric vector of donor ages in years |
DonorCVA |
numeric vector of whether donor cause of death is CVA/stroke (1 = "yes", 0 = "no") |
DonorSCr |
numeric vector of donor terminal serum creatinine |
National |
numeric vector of whether national allocation (1 = "yes", 0 = "no") |
CIT |
numeric vector of cold ischaemic time in hours |
Units |
units to use for creatinine and albumin, "SI" (default) for µmol/l and g/l, "US" for mg/dl and g/dl |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of SOFT Scores
soft(Age = 35, BMI = 20, PrevTx = 0, AbdoSurg = 1, Albumin = 30, Dx = 0, ICU = 0, Admitted = 0, MELD = 29, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 0, Ascites = 1, PortalBleed = 0, DonorAge = 44, DonorCVA = 0, DonorSCr = 110, National = 0, CIT = 8) # 7
soft(Age = 35, BMI = 20, PrevTx = 0, AbdoSurg = 1, Albumin = 30, Dx = 0, ICU = 0, Admitted = 0, MELD = 29, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 0, Ascites = 1, PortalBleed = 0, DonorAge = 44, DonorCVA = 0, DonorSCr = 110, National = 0, CIT = 8) # 7
A wrapper function using US units for the soft() vectorised function to calculate SOFT Scores for predicting patient survival after liver transplantation. The units for donor serum creatinine and recipient serum albumin in g/l.
soft_US(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT)
soft_US(Age, BMI, PrevTx, AbdoSurg, Albumin, Dx, ICU, Admitted, MELD, LifeSupport, Encephalopathy, PVThrombosis, Ascites, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT)
Age |
numeric vector of patient ages in years |
BMI |
numeric vector of patient BMI in kg/m2 |
PrevTx |
numeric vector of number of previous transplants |
AbdoSurg |
numeric vector of whether previous abdominal surgery (1 = "yes", 0 = "no") |
Albumin |
numeric vector of serum albumin in g/dl |
Dx |
numeric vector of whether on dialysis before transplant (1 = "yes", 0 = "no") |
ICU |
numeric vector of whether patients in intensive care unit before transplant (1 = "yes", 0 = "no") |
Admitted |
numeric vector of whether admitted to hospital pre-transplant (1 = "yes", 0 = "no") |
MELD |
numeric vector of MELD scores |
LifeSupport |
numeric vector of whether on life support pre-transplant (1 = "yes", 0 = "no") |
Encephalopathy |
numeric vector of whether encephalopathy present (1 = "yes", 0 = "no") |
PVThrombosis |
numeric vector of whether portal vein thrombosis (1 = "yes", 0 = "no") |
Ascites |
numeric vector of whether ascites pre-transplant (1 = "yes", 0 = "no") |
PortalBleed |
numeric vector of whether portal bleeding in 48 hours pre-transplant (1 = "yes", 0 = "no") |
DonorAge |
numeric vector of donor ages in years |
DonorCVA |
numeric vector of whether donor cause of death is CVA/stroke (1 = "yes", 0 = "no") |
DonorSCr |
numeric vector of donor terminal serum creatinine in mg/dl |
National |
numeric vector of whether national allocation (1 = "yes", 0 = "no") |
CIT |
numeric vector of cold ischaemic time in hours |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of SOFT Scores
soft_US(Age = 35, BMI = 20, PrevTx = 0, AbdoSurg = 1, Albumin = 3.0, Dx = 0, ICU = 0, Admitted = 0, MELD = 29, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 0, Ascites = 1, PortalBleed = 0, DonorAge = 44, DonorCVA = 0, DonorSCr = 1.2, National = 0, CIT = 8) # 7
soft_US(Age = 35, BMI = 20, PrevTx = 0, AbdoSurg = 1, Albumin = 3.0, Dx = 0, ICU = 0, Admitted = 0, MELD = 29, LifeSupport = 0, Encephalopathy = 1, PVThrombosis = 0, Ascites = 1, PortalBleed = 0, DonorAge = 44, DonorCVA = 0, DonorSCr = 1.2, National = 0, CIT = 8) # 7
A vectorised function to calculate SOFT Scores for predicting patient survival after liver transplantation when the P-SOFT score is already known. The P-SOFT Score can be calculated using the transplantr::p_soft() function. Alternatively, the SOFT Score can be calculated in full, including the P-SOFT parameters using the transplantr::soft() function. The units for donor serum creatinine are in µmol/l but can be changed to mg/dl by setting the Units parameter to "US".
soft2(PSoft, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT, Units = "SI")
soft2(PSoft, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT, Units = "SI")
PSoft |
numeric vector of P-SOFT scores |
PortalBleed |
numeric vector of whether portal bleeding in 48 hours pre-transplant (1 = "yes", 0 = "no") |
DonorAge |
numeric vector of donor ages in years |
DonorCVA |
numeric vector of whether donor cause of death is CVA/stroke (1 = "yes", 0 = "no") |
DonorSCr |
numeric vector of donor terminal serum creatinine |
National |
numeric vector of whether national allocation (1 = "yes", 0 = "no") |
CIT |
numeric vector of cold ischaemic time in hours |
Units |
units to use for creatinine, "SI" (default) for µmol/l, "US" for mg/dl |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of SOFT Scores
soft2(PSoft = 4, PortalBleed = 0, DonorAge = 61, DonorCVA = 1, DonorSCr = 140, National = 1, CIT = 12) # 13
soft2(PSoft = 4, PortalBleed = 0, DonorAge = 61, DonorCVA = 1, DonorSCr = 140, National = 1, CIT = 12) # 13
A wrapper using US units for the soft2() vectorised function to calculate SOFT Scores for predicting patient survival after liver transplantation when the P-SOFT score is already known. The P-SOFT Score can be calculated using the transplantr::p_soft() function. Alternatively, the SOFT Score can be calculated in full, including the P-SOFT parameters using the transplantr::soft() or transplantr::soft_US() function. The units for donor serum creatinine are in mg/dl
soft2_US(PSoft, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT)
soft2_US(PSoft, PortalBleed, DonorAge, DonorCVA, DonorSCr, National, CIT)
PSoft |
numeric vector of P-SOFT scores |
PortalBleed |
numeric vector of whether portal bleeding in 48 hours pre-transplant (1 = "yes", 0 = "no") |
DonorAge |
numeric vector of donor ages in years |
DonorCVA |
numeric vector of whether donor cause of death is CVA/stroke (1 = "yes", 0 = "no") |
DonorSCr |
numeric vector of donor terminal serum creatinine in mg/dl |
National |
numeric vector of whether national allocation (1 = "yes", 0 = "no") |
CIT |
numeric vector of cold ischaemic time in hours |
Reference: Rana A, Hardy MA, Halazun KJ, et al. Survival Outcomes Following Liver Transplantation (SOFT) Score: A Novel Method to Predict Patient Survival Following Liver Transplantation. American Journal of Transplantation 2008; 8:2537-2546.
numeric vector of SOFT Scores
soft2_US(PSoft = 4, PortalBleed = 0, DonorAge = 61, DonorCVA = 1, DonorSCr = 1.6, National = 1, CIT = 12) # 13
soft2_US(PSoft = 4, PortalBleed = 0, DonorAge = 61, DonorCVA = 1, DonorSCr = 1.6, National = 1, CIT = 12) # 13
A vectorised function to calculate the UKELD score using SI units for bilirubin and creatinine.
ukeld(INR, bili, creat, Na, units = "SI")
ukeld(INR, bili, creat, Na, units = "SI")
INR |
numeric vector of INR |
bili |
numeric vector of bilirubin in µmol/l |
creat |
numeric vector of creatinine in µmol/l |
Na |
numeric vector of sodium in mmol/l |
units |
Units for bilirubin and creatinine ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Barber KM, Madden S, Allen J, et al. Elective liver transplant list mortality: development of a United Kingdom end-stage liver disease score. Transplantation 2011; 92(4):469-76.
numeric vector of UKELD scores
ukeld(INR = 1.0, bili = 212, creat = 54, Na = 126)
ukeld(INR = 1.0, bili = 212, creat = 54, Na = 126)
A vectorised function to calculate the UKELD score using US units for bilirubin and creatinine.
ukeld_US(INR, bili, creat, Na)
ukeld_US(INR, bili, creat, Na)
INR |
numeric vector of INR |
bili |
numeric vector of bilirubin in mg/dl |
creat |
numeric vector of creatinine in mg/dl |
Na |
numeric vector of sodium in mmol/l |
Reference: Barber KM, Madden S, Allen J, et al. Elective liver transplant list mortality: development of a United Kingdom end-stage liver disease score. Transplantation 2011; 92(4):469-76.
UKELD score
ukeld_US(INR = 2.0, bili = 1.8, creat = 170, Na = 130)
ukeld_US(INR = 2.0, bili = 1.8, creat = 170, Na = 130)
A vectorised function to calculate the UK Kidney Donor Risk Index as used in the new national kidney matching scheme implemented in September 2019.
ukkdri(age, height, htn, sex, cmv, gfr, hdays)
ukkdri(age, height, htn, sex, cmv, gfr, hdays)
age |
numeric vector of donor age in years |
height |
numeric vector of donor height in cm |
htn |
numeric vector of whether donor history of hypertension (1 = yes, 0 = no) |
sex |
character vector of donor sex ("F" = female, "M" = male) |
cmv |
numeric vector of whether donor CMV IgG positive (1 = yes, 0 = no) |
gfr |
numeric vector of donor eGFR at time of donation |
hdays |
numeric vector of number of days donor in hospital before donation |
The UK KDRI is documented in the UK kidney matching policy which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
numeric vector of UK Kidney Donor Risk Index values (2019 version)
ukkdri(age = 50, height = 170, htn = 1, sex = "F", cmv = 0, gfr = 90, hdays = 2)
ukkdri(age = 50, height = 170, htn = 1, sex = "F", cmv = 0, gfr = 90, hdays = 2)
Vectorised function to convert UKKDRI values to quartiles of risk. The function takes a numeric vector of UKKDRI values as input, and returns a vector of quartiles. By default this is also a numeric vector with values 1-4, but this can be changed to a character string vector of D1-D4 to match the nomenclature in the NHSBT ODT documentation by setting the prefix parameter to TRUE. The output can also be as a vector of factors by setting fct to TRUE (this can be combined with the prefix parameter).
ukkdri_q(dri, prefix = FALSE, fct = FALSE)
ukkdri_q(dri, prefix = FALSE, fct = FALSE)
dri |
numeric vector of UKKDRI values |
prefix |
whether to prefix results with "D" (default FALSE) |
fct |
whether to return results as a factor (default FALSE) |
The UK KDRI quartile ranges are documented in the UK kidney matching policy which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
vector of UKKDRI quartiles
# obtain quartile of a single value ukkdri_q(1.01) # factor vector of results with prefix dri = c(0.69, 1.01, 1.36, 1.54) ukkdri_q(dri, prefix = TRUE, fct = TRUE)
# obtain quartile of a single value ukkdri_q(1.01) # factor vector of results with prefix dri = c(0.69, 1.01, 1.36, 1.54) ukkdri_q(dri, prefix = TRUE, fct = TRUE)
A vectorised function to calculate the UK Kidney Recipient Risk Index as used in the new national kidney matching scheme implemented in September 2019.
ukkrri(age, dx, wait, dm)
ukkrri(age, dx, wait, dm)
age |
numeric vector of patient ages in years |
dx |
numeric vector of whether on dialysis at time of listing (1 = yes, 0 = no) |
wait |
numeric vector of waiting time from start of dialysis |
dm |
numeric vector of whether patient has diabetes (1 = yes, 0 = no) |
The UK KRRI is documented in the UK kidney matching policy which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
numeric vector of UK Kidney Recipient Risk Index values
ukkrri(age = 45, dx = 0, wait = 750, dm = 0)
ukkrri(age = 45, dx = 0, wait = 750, dm = 0)
Vectorised function to convert UKKRRI values to quartiles of risk. The function takes a numeric vector of UKKRRI values as input, and returns a vector of quartiles. By default this is also a numeric vector with values 1-4, but this can be changed to a character string vector of R1-R4 to match the nomenclature in the NHSBT ODT documentation by setting the prefix parameter to TRUE. The output can also be as a vector of factors by setting fct to TRUE (this can be combined with the prefix parameter).
ukkrri_q(rri, prefix = FALSE, fct = FALSE)
ukkrri_q(rri, prefix = FALSE, fct = FALSE)
rri |
numeric vector of UKKRRI values |
prefix |
whether to prefix results with "R" (default FALSE) |
fct |
whether to return results as a factor (default FALSE) |
The UK KRRI quartile ranges are documented in the UK kidney matching policy which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk
vector of UKKRRI quartiles
# obtain quartile of a single value ukkrri_q(1.01) # factor vector of results with prefix rri = c(0.69, 0.75, 0.96, 1.36) ukkrri_q(rri, prefix = TRUE, fct = TRUE)
# obtain quartile of a single value ukkrri_q(1.01) # factor vector of results with prefix rri = c(0.69, 0.75, 0.96, 1.36) ukkrri_q(rri, prefix = TRUE, fct = TRUE)
A vectorised function to convert urea to blood urea nitrogen (BUN), By default the urea is measured in mmol/l but this can be changed to mg/dl by setting the optional units parameter to "US"
urea_to_bun(urea, units = "SI")
urea_to_bun(urea, units = "SI")
urea |
numeric vector of urea levels (mmol/l by default) |
units |
units for urea ("SI" for mmol/l, "US" for mg/dl) |
numeric vector of blood urea nitrogen (BUN) levels in mg/dl
urea_to_bun(5.4)
urea_to_bun(5.4)
Vectorised function to calculate US Kidney Donor Risk Index as published by UNOS. Please note that this function uses creatinine measured in µmol/l by default, but can be changed to mg/dl if the optional units parameter is set to "US".
uskdri(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1, units = "SI")
uskdri(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1, units = "SI")
age |
numeric vector of donor ages in years |
height |
numeric vector of donor heights in cm |
weight |
numeric vector of donor weights in kg |
eth |
character string vector of donor ethnicity, "black" or "non-black" |
htn |
numeric vector of donor hypertension history (1 = yes, 0 = no) |
dm |
numeric vector of donor diabetes history (1 = yes, 0 = no) |
cva |
numeric vector of whether donor death due to CVA (1 = yes, 0 = no) |
creat |
numeric vector of donor serum creatinine (µmol/l) |
hcv |
numeric vector of donor hepatitis C history (1 = yes, 0 = no) |
dcd |
numeric vector of type of donor (1 = DCD, 0 = DBD) |
scaling |
single numeric value for OPTN scaling factor (optional, defaults to 1) |
units |
single string value to indicate creatinine units ("SI" for µmol/l, "US" for mg/dl) |
The KDRI is normalised by a scaling factor based on the median KDRI in the previous year. For 2018, this was approximately 1.250609 as is published on the OPTN website. The scaling parameter in this function defaults to 1, so can be left out to calculate the KDRI without scaling.
Reference: Rao PS, Schaubel DE, Guidinger MK, et al. A Comprehensive Risk Quantification Score for Deceased Donor Kidneys: The Kidney Donor Risk Index. Transplantation 2009; 88:231-236.
numeric vector of US KDRI values
# with creatinine in µmol/l (units = "SI" can be omitted) uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 120, hcv = 0, dcd = 0, scaling = 1.250609, units = "SI") # with creatinine in mg/dl uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609, units = "US")
# with creatinine in µmol/l (units = "SI" can be omitted) uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 120, hcv = 0, dcd = 0, scaling = 1.250609, units = "SI") # with creatinine in mg/dl uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0, scaling = 1.250609, units = "US")
Wrapper function for the uskdri() vectorised function to calculate US Kidney Donor Risk Index as published by UNOS but using mg/dl as the units for creatinine.
uskdri_US(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1)
uskdri_US(age, height, weight, eth, htn, dm, cva, creat, hcv, dcd, scaling = 1)
age |
numeric vector of donor ages in years |
height |
numeric vector of donor heights in cm |
weight |
numeric vector of donor weights in kg |
eth |
character string vector of donor ethnicity, "black" or "non-black" |
htn |
numeric vector of donor hypertension history (1 = yes, 0 = no) |
dm |
numeric vector of donor diabetes history (1 = yes, 0 = no) |
cva |
numeric vector of whether donor death due to CVA (1 = yes, 0 = no) |
creat |
numeric vector of donor serum creatinine (mg/dl) |
hcv |
numeric vector of donor hepatitis C history (1 = yes, 0 = no) |
dcd |
numeric vector of type of donor (1 = DCD, 0 = DBD) |
scaling |
single numeric value for OPTN scaling factor (optional, defaults to 1) |
The KDRI is normalised by a scaling factor based on the median KDRI in the previous year. For 2018, this was approximately 1.250609 as is published on the OPTN website. The scaling parameter in this function defaults to 1, so can be left out to calculate the KDRI without scaling.
Reference: Rao PS, Schaubel DE, Guidinger MK, et al. A Comprehensive Risk Quantification Score for Deceased Donor Kidneys: The Kidney Donor Risk Index. Transplantation 2009; 88:231-236.
numeric vector of US KDRI values
uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0)
uskdri(age = 40, height = 170, weight = 80, eth = "non-black", htn = 0, dm = 0, cva = 0, creat = 1.4, hcv = 0, dcd = 0)
A vectorised function to calculate eGFR using the Walser formula. By default the equation accepts serum creatinine in µmol/l but can be changed to mg/dl by setting the units parameter to "US". It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
walser(SCr, Age, Weight, Sex, Units = "SI")
walser(SCr, Age, Weight, Sex, Units = "SI")
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Age |
numeric vector of patient ages in years |
Weight |
numeric vector of patient weights in kilograms |
Sex |
character vector of sex ("F" for female, "M" for male) |
Units |
non-vectorised optional parameter for creatinine units ("SI" for µmol/l (default), "US" for mg/dl) |
Reference: Walser M, Drew HH, Guldan JL. Prediction of glomerular filtration rate in advanced chronic renal failure. Kidney International 1993; 44:2245-1148.
numeric vectors of eGFR values
walser(SCr = 118, Age = 74, Weight = 65, Sex = "M") # 56.1
walser(SCr = 118, Age = 74, Weight = 65, Sex = "M") # 56.1
A wrapper function for the walser() vectorised function to calculate eGFR using the Walser formula, using serum creatinine in mg/dl. It has not been possible to run automated tests to confirm the accuracy of this function, so please use with caution.
walser_US(SCr, Age, Weight, Sex)
walser_US(SCr, Age, Weight, Sex)
SCr |
numeric vector of serum creatinine in µmol/l (or mg/dl if units = "US") |
Age |
numeric vector of patient ages in years |
Weight |
numeric vector of patient weights in kilograms |
Sex |
character vector of sex ("F" for female, "M" for male) |
Reference: Walser M, Drew HH, Guldan JL. Prediction of glomerular filtration rate in advanced chronic renal failure. Kidney International 1993; 44:2245-1148.
numeric vectors of eGFR values
walser_US(SCr = 1.33, Age = 74, Weight = 65, Sex = "M") # 56.3
walser_US(SCr = 1.33, Age = 74, Weight = 65, Sex = "M") # 56.3
A vectorised function to calculate the UK Kidney Donor Risk Index as published by Watson et al. in 2012. Please note that this is not the same risk index as used in the new UK kidney matching scheme starting in September 2019.
watson_ukkdri(age, htn, weight, hdays, adrenaline)
watson_ukkdri(age, htn, weight, hdays, adrenaline)
age |
numeric vector of donor ages |
htn |
numeric vector of whether donor history of hypertension (1 = yes, 0 = no) |
weight |
numeric vector of donor weights in kg |
hdays |
numeric vector of donor length of hospital stay |
adrenaline |
numeric vector of whether donor treated with adrenaline (1 = yes, 0 = no) |
Reference: Watson CJE, Johnson RJ, Birch R, et al. A Simplified Donor Risk Index for Predicting Outcome After Deceased Donor Kidney Transplantation. Transplantation 2012; 93(3):314-318
numeric vector of UK Kidney Donor Risk Index (2012) values
watson_ukkdri(age = 40, htn = 0, weight = 75, hdays = 0, adrenaline = 0) # 1.00
watson_ukkdri(age = 40, htn = 0, weight = 75, hdays = 0, adrenaline = 0) # 1.00