I would like to use CreateTableOne()
to calculate SMD(standardized mean difference)
of variables between two groups(grou=0
and grou=1
) after Mice imputed. But I found that CreateTableOne()
could not be nested inside with()
.
library(tableone)
library(MICE)
data("nhanes2")
vars=c("bmi","chl","age","hyp")
catvars=c("age","hyp")
data_im=mice(nhanes2,m=5,seed=6666)
pool(with(data_im,CreateTableOne(vars = vars, factorVars= catvars,strata = "hyp", test =TRUE)))
# **Error in ModuleStopIfNotDataFrame(data) :
# argument "data" is missing, with no default
How to calculate SMD of imputed dataset through pool()?