Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when using mice object: No applicable method for 'complete_'

Tags:

r

r-mice

library(mice)
md.pattern(dat1)
temp<-mice(dat1, m = 5, seed = 101)
dat1 <- complete(temp, 2)

Error in UseMethod("complete_") :
no applicable method for 'complete_' applied to an object of class "mids"

Hi, I'm trying to impute missing values using mice package. But I got the above error message. The first time I imputed missing data it worked, but when I tried again it didn't. I've tried a lot with different options (changing seed, deleting existing data or "temp" variable)

Sometimes it worked but other times it didn't. What is the problem and solution? Thanks in advance.

like image 609
Jonggi Choi Avatar asked Nov 22 '16 01:11

Jonggi Choi


3 Answers

I think the problem here is that you should rather be using some other libraries in your program which have a function named "complete". Just typing "complete" in help menu gave me 2 other libraries (tidyr,RCurl) which have the function in the same name. As simon suggested, I tried using "mice::complete". It works for me.

like image 83
Eswar Avatar answered Sep 22 '22 06:09

Eswar


Try this:

dat1<-mice::complete(temp,2)
like image 40
Yuri Vladimir Plasencia Avatar answered Sep 19 '22 06:09

Yuri Vladimir Plasencia


mice 3.7.5 redefines the complete() function as the S3 complete.mids() method for the generic tidyr::complete().

Assuming that mice is attached, you should no longer see no applicable method for 'complete_' applied to an object of class "mids".

like image 30
Stef van Buuren Avatar answered Sep 20 '22 06:09

Stef van Buuren