Reputation: 21
I'm trying to impute missing data with the "mi" package in r and I keep getting an error on all my variables
My code:
mdf <- missing_data.frame(data.frame)
Error I get:
Error in .guess_type(y, favor_ordered, favor_positive, threshold, variable_name) : age : must be a vector
When I check type:
typeof(data.frame$age)
I get:
[1] "double"
Anyone know the best way to fix this?
Upvotes: 1
Views: 1717
Reputation: 11
I know its too late but I was having the same issue and tried changing it from tibble it still didn't work.
This is what worked: y = as.vector(y)
Thought it might be helpful to someone.
Upvotes: 1
Reputation: 21
Turns out it was a tibble and needed to be a data.frame for this function. This worked:
datasetdf <- as.data.frame(dataset)
mdf <- missing_data.frame(datasetdf)
Upvotes: 1