The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Estimated glomerular filtration rate (eGFR) calculation

Boris Bikbov, Scientific-Tools.Org

2025-03-31

Estimated glomerular filtration rate (eGFR) calculation

kidney.epi R package includes functions for calculation of eGFR by different equations.

Data frames

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

Functions to calculate eGFR by different equations

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:

If 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.

Examples

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.

Example for a single patient

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

Example for a cohort of patients

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 if necessary
  label_afroamerican = c("Black"),
  label_sex_male = c("Male"), label_sex_female = c("Female")
) 
#> Warning in service.check_plausibility.age(age, max_age): There is 1 patient with negative values for age.  This value was substituted to NA.
#> Warning in service.check_plausibility.age(age, max_age): There is 1 patient with age >100 years.  This value was substituted to NA.
#> There are 840 patients with age <18 years.  These values were substituted to NA.

# 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.44   45.19   51.80   59.85  179.11     841

Advantages of the kidney.epi package functions

There are several advantages of the kidney.epi package functions for calculating eGFR values:

References

References for each eGFR equation are listed in the documentation to the package.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.