kidney.epi R package includes functions for calculation of eGFR by different equations.
library(kidney.epi)
#> The kidney.epi package is made with care by the research consultancy Scientific-Tools.Org.
#> Contact us at https://Scientific-Tools.Org or via 'maintainer("kidney.epi")' for data analysis or software development.
head(ckd.data)
#> cr cys age sex ethnicity height category
#> 1 108.10 1.29 73.8 Male Caucasian NA adults
#> 2 101.12 1.26 66.8 Male Caucasian NA adults
#> 3 139.99 1.63 75.9 Male Caucasian NA adults
#> 4 145.26 1.75 68.1 Female Caucasian NA adults
#> 5 148.21 1.74 51.7 Female Caucasian NA adults
#> 6 179.43 2.14 41.8 Male Caucasian NA adults
kidney.epi contains a set of functions to calculate eGFR by different equations either for a single patient or for a dataset.
The following eGFR equations are supported:
egfr.ckdepi.cr.2021()
and its alias
egfr.ckdepi.cr()
egfr.ckdepi.cr_cys.2021()
egfr.ckdepi.cr.2009()
egfr.ekfc.cr()
egfr.ekfc.cys()
egfr.fas.cr()
egfr.fas.cys()
egfr.fas.cr_cys()
egfr.lm.cr()
egfr.mdrd4()
egfr.bis.cr()
egfr.bis.cr_cys()
egfr.schwartz.cr()
egfr.schwartz.cys()
egfr.schwartz.cr_cys()
egfr.ckid_u25.cr()
egfr.ckid_u25.cys()
egfr.cg.cr()
(even if it calculates creatinine clearance, the ‘egfr’ is used in the
function name)egfr.all_adults.cr()
, egfr.all_adults.cys()
,
egfr.all_adults.cr_cys()
- return a data frame with columns
representing different eGFR equationsIf you use these functions from kidney.epi package for the data analysis and manuscript preparation, please cite the package: “Bikbov B. kidney.epi: Kidney-Related Functions for Clinical and Epidemiological Research. Scientific-Tools.Org, https://Scientific-Tools.Org. doi:10.32614/CRAN.package.kidney.epi”.
Contact us for data analysis or software development at Scientific-Tools.Org or via ‘maintainer(“kidney.epi”)’, connect with the author on LinkedIn.
The vignette demonstrates the usage of eGFR calculation by the CKD-EPI 2009 equation, but race-free CKD-EPI 2021 and other equations work in the same way.
To calculate for a single patient, use the following syntax:
# call egfr.ckdepi.cr.2009 function, and directly set parameters values
egfr.ckdepi.cr.2009(
creatinine = 1.4,
age = 60,
sex = "Male",
ethnicity = "White",
creatinine_units = "mg/dl",
label_afroamerican = c("Afroamerican"),
label_sex_male = c("Male"),
label_sex_female = c("Female")
)
#> [1] 54.22
# Definitions of the labels for sex and race are optional if you use the same labels defined as default in the function. The following also works well:
egfr.ckdepi.cr.2009(
creatinine = 1.4,
age = 60,
sex = "Male",
ethnicity = "White",
creatinine_units = "mg/dl"
)
#> [1] 54.22
# If you measure creatinine in micromol/l, it is possible to omit also 'creatinine_units' since the default value is "micromol/l":
egfr.ckdepi.cr.2009(
creatinine = 103, # creatinine is in micromol/l
age = 60,
sex = "Male",
ethnicity = "White"
)
#> [1] 67.7
To calculate eGFR for a cohort of patients in a dataset, use the following syntax:
# copy as an example the internal dataframe ckd.data from R package to your dataframe
mydata <- ckd.data
# calculate eGFR by CKD-EPI equation
mydata$ckdepi <- egfr.ckdepi.cr.2009(
creatinine = mydata$cr, age = mydata$age,
sex = mydata$sex, ethnicity = mydata$ethnicity,
creatinine_units = "micromol/L",
# customize all labels for those used in the data frame
# label(s) used to define male sex in the dataset
label_sex_male = c("Male"),
# label(s) used to define female sex in the dataset
label_sex_female = c("Female"),
# label used to define Afroamerican ethnicity in the dataset
label_afroamerican = c("Black")
)
#> Warning: For age the following incorrect values were detected and excluded from calculations (substituted with NA):
#> 1 value is greater than 100
#> 845 values are lower or equal than 18
#> Use children-specific eGFR equations for children younger than 18 years
#> Scientific-Tools.Org takes precision seriously.
# show descriptive stat for the calculated values
# note that synthetic data set ckd.data contains input parameters for both adults and children, and since the CKD-EPI equation was developed and validated for adults only, the resulting eGFR values for children will be NA. Use children-specific eGFR equations when necessary.
summary(mydata$ckdepi)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
#> 17.78 35.42 45.03 51.56 59.81 179.11 846
References for each eGFR equation are listed in the documentation to the package.