mergeitmice: Merges Imputed Datasets with Dataframes

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mergeitmice.R

Description

The mergeitmice() function merges a dataframe with each imputed dataset of the mids, mimids, or wimids class objects based on the variables passed to the function as by.

Usage

1

Arguments

datasets

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

data

This argument specifies a dataframe.

by

This argument specifies a variable name, present in bot datasets and data.

Details

This functions can be used instead of the cbind() function (from the mice package).

Value

This function returns an object of the mids, mimids, or wimids class after merging a dataframe with each imputed dataset of the inputted object.

Author(s)

Farhad Pishgar

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

matchitmice

weightitmice

binditmice

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#Loading the 'dt.osa' and 'dt.osp' datasets
data(dt.osa)
data(dt.osp)

#Imputing missing data points in the'dt.osa' dataset
datasets <- mice(dt.osa, m = 5, maxit = 1,
                 method = c("", "", "mean", "", "polyreg", "logreg", "logreg"))

#Matching the imputed datasets, 'datasets'
matcheddatasets <- matchitmice(KOA ~ SEX + AGE + SMK, datasets,
                               approach = 'within', method = 'exact')

#Merging the dataframe, 'dt.osp', with each imputed dataset of the 'matcheddatasets' object
matcheddatasets <- mergeitmice(matcheddatasets, dt.osp, by = "IDN")

MatchIt.mice documentation built on Aug. 28, 2019, 1:03 a.m.