Reputation: 27
I want to use mice function to handle the missing data that I have in (data). I installed the package and I called the library. However, when I am trying to apply the function to my data it gives me error as below:
(Error in mice(data[, 5:9], m = 3, seed = 123) : could not find function "mice")
I have a normal data frame that includes NAs
install.packages('mice')
library(mice)
library(VIM)
md.pattern(data)
md.pairs(data)
My_New_Data <- mice(data[,5:9], m=3, seed=123)
I am expecting the function to solve the problem and replace the NAs with reasonable values. It did not work at all!
In the comments the running mice::mice(data[, 5:9], m = 3, seed = 123)
. I ran this and the following error was returned.
Error in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/MUSTAFA KAMAL/Documents/R/win-library/3.5/broom/R/broom.rdb' is corrupt
In addition:
Warning message: In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Upvotes: 2
Views: 7181
Reputation: 8582
In order to incorporate an answer to this question, I will rewrite my comment which resolved the problem, in the form of a short answer.
From the comments executing mice::mice(data[, 5:9], m = 3, seed = 123)
resulted in an error message, showing the directory ~/Documents/R/win-library/**3.5**/broom/R/broom.rdb
being corrupt.
From the corrupted directory path, one can see that OP was running R-3.5.x
, while the newest version is R-3.6.x
. Some packages updated since the most recent R-update has experienced similar problems, as such a first step towards solving these types of issues is updating R
. The installr
contains the function updateR
which can help smooth over such updates, while also updating any outdated packages.
As a side note, an update sometimes fails to update the actual packages or results in other packages being corrupted, as such if an error persists one solution is to simply delete and re-install the package (or the entire ~/Documents/R/win-library/3.z/
directory). In the question from OP the corrupt package is the broom
package, as such one could re-install this package by running
remove.packages("broom")
install.packages("broom")
which should resolve any leftover issues. Note however multiple packages might be corrupt, and likely only one will be shown every time the function is executed. In such cases a full package clear will do the trick, but requires re-installing all packages. For this one can export all installed packages prior to removing them all, by noting that a full list of installed packages is contained in installed.packages()
, which can then be exported to a file with for example write.table
or write.csv
.
Upvotes: 1