l <- data.frame(
param = c("alb", "bili"),
age = c(0, 0),
sex = c("both", "both"),
units = c("mg/l", "µmol/l"),
lower = c(35, 2),
upper = c(52, 21)
)
x <- data.frame(
age = 40:48,
sex = rep(c("female", "male"), c(5, 4)),
# from Hoffmann et al. 2017
alb = c(42, NA, 38, NA, 50, 42, 27, 31, 24),
bili = c(11, 9, NA, NA, 22, 42, NA, 200, 20)
)
impute_df(x, l)
impute_df(x, l, method = "min")
zlog_df(impute_df(x, l), l)
Run the code above in your browser using DataLab