[R] Need help imputing missing data using mice and outputting them

From: John Smith <ld7631_at_yahoo.com>
Date: Thu, 10 May 2007 10:47:29 -0700 (PDT)

I am trying to impute missing data and output the results of the imputation.

My data set is called: MyData.
I have a bunch of variables all of which start with Q20_ - and some of them have missing values. Here is what I've been doing:

imputationmodel<-mice( MyData[ c (grep("Q20_", names(MyData)) ) ] )


write.table(as.data.frame(lapply(multipledataset,function(x) {as.numeric(is.element(x,5))} )), sep="\t",file="multiset.txt",row.names=F)

The last line (write.table) makes it so that all the values get changed into 0s and 1s. How could I output the original imputed values (in my case, they should be 1s or 2s or 3s or 4s or 5s) rather than 0s and 1s?

Thank you very much!

        [[alternative HTML version deleted]]

R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 10 May 2007 - 17:51:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 May 2007 - 18:31:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.