require(data.table)
d <- data.table(ht=c(68, 60), wt=c(280, 135), chol=c(120, 150))
derived <- list(
list(bmi = expression(703 * wt / ht ^ 2),
label='Body Mass Index',
units='Kg/m^2'),
list(bsa=expression(0.007184 * (0.4536 * wt) ^ 0.425 * (2.54 * ht) ^ 0.725),
label='Body Surface Area',
units='m^2', drop=.q(wt, ht) ) )
runDeriveExpr(d, derived)
print(d)
contents(d)
Run the code above in your browser using DataLab