Jonggi Choi
Jonggi Choi

Reputation: 81

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

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.

Upvotes: 8

Views: 5288

Answers (3)

Stef van Buuren
Stef van Buuren

Reputation: 408

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".

Upvotes: 1

Try this:

dat1<-mice::complete(temp,2)

Upvotes: 1

Eswar
Eswar

Reputation: 309

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.

Upvotes: 14

Related Questions