This R package is for medical staff such as pharmacists to use for preprocessing clinical data.
You can install the released version of pharmaprepro from GitHub with:
install.packages("devtools")
require(devtools)
install_github("nyubachi/pharmaprepro")
# loading package
library(pharmaprepro)
# test data
x <- data.frame(age = c(109, 98, 72, 25),
height = c(161.5, 182.5, 170.1, 155.4),
weight = c(55.2, 70.2, 60.5, 54.8),
scr = c(0.4, 0.9, 1.1, 0.5),
gender = c("female", "male", "male", "female"),
birthday = c("M43.09.12", "T10.11.05", "S22/03/31", "H06-12-29"),
target_day = c("1990/06/10", "2010/04/22", "2018/12/03", "2015/10/03"))
Calculate the age on the specific date.
# Convert birthday from Japanese calendar to Christian calendar year.
birthday <- wareki2seireki(x$birthday)
# Calculate age from birthday and target date.
agecalc(birthday, x$target_day)
#> [1] 79 88 71 20
# If the second argument is omitted, today is entered.
agecalc(birthday)
#> [1] 108 97 71 24
Calculate the body mass index from height and weight data.
bmicalc(x$height, x$weight)
#> [1] 21.16 21.08 20.91 22.69
Calculate the body surface area from height and weight data.
# If the third argument is 1 (default), using the DuBois formula.
bsacalc(x$height, x$weight, 1)
#> [1] 1.58 1.91 1.70 1.53
# If the third argument is 2, using the Shintani formula.
bsacalc(x$height, x$weight, 2)
#> [1] 1.61 1.95 1.74 1.57
# If the third argument is 3, using the Fujimoto formula.
bsacalc(x$height, x$weight, 3)
#> [1] 1.53 1.85 1.65 1.49
Calculate creatinine clearance.
# When the fifth argument is 1 (default), if scr is less than 0.6, it rounds up to 0.6.
ccrcalc(x$age, x$weight, x$scr, x$gender, 1)
#> [1] 33.67 45.50 51.94 124.00
# If the fifth argument is 0, scr is not corrected.
ccrcalc(x$age, x$weight, x$scr, x$gender, 0)
#> [1] 50.50 45.50 51.94 148.80
Calculate standard weight from height data.
stdwtcalc(x$height)
#> [1] 57.38 73.27 63.65 53.13
Convert Japanese calendar to Christian calendar.
wareki2seireki(x$birthday)
#> [1] "1910-09-12" "1921-11-05" "1947-03-31" "1994-12-29"