
Categorize Renal Function
rfc.RdThis function categorizes renal function based on estimated glomerular filtration rate (eGFR), creatinine clearance, or other renal function estimators. It supports both clinical and regulatory categorization standards and can convert between absolute (mL/min) and relative (mL/min/1.73m²) units using body surface area.
Usage
rfc(
estimator = NULL,
bsa = NULL,
category_standard = c("regulatory", "clinical"),
absolute_units = NULL
)Arguments
- estimator
Numeric vector of renal function estimator values (eGFR, CrCL, etc.)
- bsa
Numeric vector of body surface area in m² for unit conversion. Required when converting between absolute and relative units
- category_standard
Character string specifying categorization standard:
"regulatory"(default) or"clinical"- absolute_units
Logical indicating if
estimatorunits are mL/min (TRUE) or mL/min/1.73m² (FALSE)
Value
Integer vector of renal impairment categories (1-4 for regulatory, 1-5 for clinical).
Returns -999 for missing values. Includes a category_standard attribute
indicating the source ("FDA" or "KDIGO").
Details
The function applies different categorization schemes based on the category_standard:
Regulatory categories (uses mL/min):
1: Normal: ≥90 mL/min
2: Mild impairment: 60-89 mL/min
3: Moderate impairment: 30-59 mL/min
4: Severe impairment: <30 mL/min
Clinical categories (uses mL/min/1.73m²):
1: Normal: ≥90 mL/min/1.73m²
2: Mild impairment: 60-89 mL/min/1.73m²
3: Moderate impairment: 30-59 mL/min/1.73m²
4: Severe impairment: 15-29 mL/min/1.73m²
5: End-stage: <15 mL/min/1.73m²
When unit conversion is required, the function uses:
Absolute to relative:
relative = 1.73 (absolute / bsa)Relative to absolute:
absolute = relative (bsa / 1.73)
References
FDA Guidance for Industry: Pharmacokinetics in Patients with Impaired Renal Function. https://www.fda.gov/media/78573/download
KDIGO 2024 Clinical Practice Guideline for the Evaluation and Management of Chronic Kidney Disease. https://www.kidney-international.org/action/showPdf?pii=S0085-2538(23)00766-4
See also
egfr for calculating eGFR, crcl for creatinine clearance,
bsa for body surface area calculation
Other renal_function:
aegfr(),
ckdepi_2009_egfr(),
ckdepi_2021_egfr(),
ckdepi_2021_egfr_cystatin(),
crcl(),
egfr(),
mdrd_egfr(),
schwartz_egfr()
Examples
# Regulatory categories with absolute units (creatinine clearance)
rfc(estimator = c(95, 75, 45, 25), absolute_units = TRUE)
#> [1] 1 2 3 4
#> attr(,"category_standard")
#> [1] "FDA"
# Clinical categories with relative units (eGFR)
rfc(
estimator = c(95, 75, 45, 25, 10),
absolute_units = FALSE,
category_standard = "clinical"
)
#> [1] 1 2 3 4 5
#> attr(,"category_standard")
#> [1] "KDIGO"
# Convert relative eGFR to regulatory categories
rfc(
estimator = 65,
absolute_units = FALSE,
bsa = 1.8
)
#> [1] 2
#> attr(,"category_standard")
#> [1] "FDA"
# Pipeline example with realistic data
df <- data.frame(
ID = 1:4,
SEX = c("F", "M", "F", "M"),
AGE = c(65, 45, 70, 50),
CREAT = c(1.2, 0.9, 1.5, 1.1),
WEIGHT = c(70, 80, 60, 85),
HEIGHT = c(165, 175, 160, 180),
RACE = c("WHITE", "BLACK", "OTHER", "ASIAN")
)
library(dplyr)
df %>%
mutate(
BSA = bsa(WEIGHT, HEIGHT, method = "Dubois"),
EGFR = egfr(is_female(SEX), is_black(RACE), AGE, CREAT),
AEGFR = aegfr(EGFR, BSA),
# Clinical categories using relative eGFR directly
BRFC_CLINICAL = rfc(EGFR, category_standard = "clinical"),
# Regulatory categories - convert relative eGFR to absolute
BRFC_REGULATORY_REL = rfc(EGFR, BSA),
# Regulatory categories - AEGFR already absolute
BRFC_REGULATORY_ABS = rfc(AEGFR)
)
#> ID SEX AGE CREAT WEIGHT HEIGHT RACE BSA EGFR AEGFR
#> 1 1 F 65 1.2 70 165 WHITE 1.770960 50.23467 51.42405
#> 2 2 M 45 0.9 80 175 BLACK 1.956060 107.33541 121.36097
#> 3 3 F 70 1.5 60 160 OTHER 1.622063 37.25688 34.93236
#> 4 4 M 50 1.1 85 180 ASIAN 2.048528 81.78201 96.83973
#> BRFC_CLINICAL BRFC_REGULATORY_REL BRFC_REGULATORY_ABS
#> 1 3 3 3
#> 2 1 1 1
#> 3 3 3 3
#> 4 2 1 1
df
#> ID SEX AGE CREAT WEIGHT HEIGHT RACE
#> 1 1 F 65 1.2 70 165 WHITE
#> 2 2 M 45 0.9 80 175 BLACK
#> 3 3 F 70 1.5 60 160 OTHER
#> 4 4 M 50 1.1 85 180 ASIAN