scicalc provides common calculations for PK/PD dataset preparation and analysis, including renal function, body measurements, organ function classification, and reproducible data I/O with hash verification.
You can install the development version of scicalc from
GitHub with:
# pak::pkg_install("a2-ai/scicalc")
install.packages("scicalc", repos = c('https://a2-ai.r-universe.dev', 'https://cloud.r-project.org'))
is_female(), is_black(),
is_asian(), etc. for use in clinical equationslibrary(scicalc)
library(dplyr)
# Sample patient data
patients <- data.frame(
ID = 1:4,
SEX = c("Female", "Male", "Female", "Male"),
RACE = c("White", "Black", "Asian", "White"),
AGE = c(45, 62, 38, 71),
WEIGHT = c(68, 85, 55, 78),
HEIGHT = c(165, 178, 158, 172),
CREAT = c(0.9, 1.4, 0.7, 1.8)
)
# Calculate derived values
patients <- patients |>
mutate(
BSA = bsa(WEIGHT, HEIGHT),
EGFR = egfr(is_female(SEX), is_black(RACE), AGE, CREAT),
AEGFR = aegfr(EGFR, BSA),
RFC = rfc(AEGFR)
)
patients
#> ID SEX RACE AGE WEIGHT HEIGHT CREAT BSA EGFR AEGFR RFC
#> 1 1 Female White 45 68 165 0.9 1.749277 80.34339 81.23862 2
#> 2 2 Male Black 62 85 178 1.4 2.032001 56.82811 66.74842 2
#> 3 3 Female Asian 38 55 158 0.7 1.548984 113.45681 101.58541 1
#> 4 4 Male White 71 78 172 1.8 1.911017 39.74485 43.90352 3
See the package website for full documentation.