imputationList {mitools} | R Documentation |
Create and update imputationList
objects to be used as input to other
MI
routines.
imputationList(datasets) ## S3 method for class 'imputationList': update(object,...) ## S3 method for class 'imputationList': rbind(...) ## S3 method for class 'imputationList': cbind(...)
datasets |
a list of data frames corresponding to the multiple imputations |
object |
An object of class imputationList |
... |
Arguments tag=expr to update
will create new variables tag by evaluating expr
in each imputed dataset |
An object of class imputationList
data.dir<-system.file("dta",package="mitools") files.men<-list.files(data.dir,pattern="m.\.dta$",full=TRUE) men<-imputationList(lapply(files.men, foreign::read.dta)) files.women<-list.files(data.dir,pattern="f.\.dta$",full=TRUE) women<-imputationList(lapply(files.women, foreign::read.dta)) men<-update(men, sex=1) women<-update(women,sex=0) all<-rbind(men,women) all<-update(all, drinkreg=as.numeric(drkfre)>2) all