Cannot run library(mice) on R version 4.0.2

library(mice)
Error: package or namespace load failed for ‘mice’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘R6’
In addition: Warning message:
package ‘mice’ was built under R version 4.0.5
data <- read.csv(file.choose(), header = TRUE, sep=";")
imp <- 100
tempData <- mice(data,m=imp,maxit=5,seed=7)
Error in mice(data, m = imp, maxit = 5, seed = 7) :
could not find function "mice"

You are missing a package dependency, you have to install it first.

install.packages("R6")

Thank you - I actually did that before you replied. Now I have a problem with mice checking for multicollinearity and removing all the predictors. My collaborator at the University of Liverpool is not experiencing this with R version 4.0.2. My R was a later version, so I backgraded it to be version 4.0.2 but mice must be 4.0.5? I do not want mice to check for multicollinearity - is it possible a previous version of mice was not doing this check? My goal is to reproduce the results in a published paper as part of my Master's Thesis. And R's mice package is what was used in this paper, as oppose to Python's implementation of mice via statsmodel.imputation.mice.

Warning message:
package ‘mice’ was built under R version 4.0.5

data <- read.csv(file.choose(), header = TRUE, sep=";")
imp <- 100
tempData <- mice(data,m=imp,maxit=5,seed=7)
Error in edit.setup(data, setup, ...) :
mice detected constant and/or collinear variables. No predictors were left after their removal.

This is a very different question, we like to keep things tidy around here so please ask it on a new topic providing a proper REPRoducible EXample (reprex) illustrating your issue.

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.