as.mids {mice} | R Documentation |
mids
objectThis function converts imputed data stored in long format into an object of class mids
.
The original incomplete data set needs to be available so that we know where the missing data are.
The function is useful to convert back operations applied to the imputed data
back in a mids
object. It may also be used to store multiply imputed data sets
from other software into the format used by mice
.
as.mids(data, .imp=1, .id=2)
data |
A multiply imputed data set in long format |
.imp |
Mandatory column indicator for the multiple imputation stream, where |
.id |
Optional column indicator for the row numbers. Default is |
If .id
is specified, row names from the original data (if supplied) will be copied to the mids
object.
An object of class mids
Gerko Vink, 2012
# nhanes example without .id imp <- mice(nhanes, print = FALSE) X <- complete(imp, action = "long", include = TRUE)[, -2] test <- as.mids(X, .id = NULL) is.mids(test) test.dat <- complete(test, action = "long", include = TRUE) # Test on boys data imp <- mice(boys, print = FALSE, maxit = 1) X <- complete(imp, action = "long", include = TRUE) test <- as.mids(X) is.mids(test) test.dat <- complete(test, action = "long", include = TRUE) # original rownumbers are automatically copied from .id