Learn R Programming

mice (version 2.46.0)

rbind.mids: Rowwise combination of a mids object.

Description

Append mids objects by rows

Usage

# S3 method for mids
rbind(x, y = NULL, ...)

Arguments

x

A mids object.

y

A mids object, or a data.frame, matrix, factor or vector.

Additional data.frame, matrix, vector or factor. These can be given as named arguments.

Value

An S3 object of class mids

Details

This function combines two mids objects rowwise into a single mids object, or combines a mids object with a vector, matrix, factor or dataframe rowwise into a mids object. The columns in the (incomplete) data x$data and y (or y$data if y is a mids object) should match. If y is a mids object, then rbind only works if the number of multiple imputations in x and y is equal.

References

van Buuren S and Groothuis-Oudshoorn K (2011). mice: Multivariate Imputation by Chained Equations in R. Journal of Statistical Software, 45(3), 1-67. http://www.jstatsoft.org/v45/i03/

See Also

cbind.mids, ibind, mids

Examples

Run this code
# NOT RUN {
imp1 <- mice(nhanes[1:13, ], m = 2, maxit = 1, print = FALSE)
imp5 <- mice(nhanes[1:13, ], m = 2, maxit = 2, print = FALSE)
mylist <- list(age = NA, bmi = NA, hyp = NA, chl = NA)

nrow(complete(rbind(imp1, imp5)))
nrow(complete(rbind(imp1, mylist)))

# Note: If one of the arguments is a data.frame 
# we need to explicitly call mice:::rbind.mids()
nrow(complete(mice:::rbind.mids(imp1, data.frame(mylist))))
nrow(complete(mice:::rbind.mids(imp1, complete(imp5))))
# }

Run the code above in your browser using DataLab