
Calculates renal impairment categories based on Renal Function Estimator
rfc.Rd
This 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,
absolute_units = NULL,
bsa = NULL,
category_standard = c("regulatory", "clinical")
)
Arguments
- estimator
Numeric vector of renal function estimator values (eGFR, CrCL, etc.)
- absolute_units
Logical indicating if
estimator
units are mL/min (TRUE
) or mL/min/1.73m² (FALSE
)- 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"
Value
Integer vector of renal impairment categories (1-4 for regulatory, 1-5 for clinical).
Returns -999
for missing values.
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)
Examples
# Regulatory categories with absolute units (creatinine clearance)
rfc(estimator = c(95, 75, 45, 25), absolute_units = TRUE)
#> [1] 1 2 3 4
# 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
# Convert relative eGFR to regulatory categories
rfc(
estimator = 65,
absolute_units = FALSE,
bsa = 1.8
)
#> [1] 2
# 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(
EGFR = egfr(is_female(SEX), is_black(RACE), AGE, CREAT),
BSA = bsa(WEIGHT, HEIGHT, method = "Dubois"),
# Clinical categories using eGFR directly
BRFC_CLINICAL = rfc(EGFR, FALSE, category_standard = "clinical"),
# Regulatory categories converting eGFR to absolute
BRFC_REGULATORY = rfc(EGFR, FALSE, BSA)
)
#> ID SEX AGE CREAT WEIGHT HEIGHT RACE EGFR BSA BRFC_CLINICAL
#> 1 1 F 65 1.2 70 165 WHITE 47.38724 1.770960 3
#> 2 2 M 45 0.9 80 175 BLACK 119.12934 1.956060 1
#> 3 3 F 70 1.5 60 160 OTHER 34.93361 1.622063 3
#> 4 4 M 50 1.1 85 180 ASIAN 77.86046 2.048528 2
#> BRFC_REGULATORY
#> 1 3
#> 2 1
#> 3 3
#> 4 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