Learn R Programming

MatchThem (version 0.8.1)

bindthem: Binds Imputed Datasets and Dataframes

Description

The bindthem() function binds a dataframe to each imputed dataset of the mimids or wimids class objects in a row-wise fashion.

Usage

bindthem(datasets, data)

Arguments

datasets

This argument specifies an object of the mimids or wimids class.

data

This argument specifies a dataframe.

Value

This function returns an object of the mimids or wimids class after binding a dataframe to each imputed dataset of the inputted object.

Details

This functions can be used similar to the cbind() function (from the mice package).

References

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

See Also

matchthem

weightthem

mergethem

Examples

Run this code
# NOT RUN {
#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
                         method = c("", "", "mean", "polyreg", "logreg", "logreg", "logreg"))

#Matching the multiply imputed datasets
matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                              approach = 'within', method = 'nearest')

#Binding a (sorted) dataframe to imputed datasets of the 'matched.datasets'
#(assume that 'data' is a dataset with information on new variables)
matched.datasets <- bindthem(matched.datasets, data)
# }

Run the code above in your browser using DataLab