Hey All,
I am having a bit of trouble using mice and micemd with renv. My code runs fine when using my global library. However, for production purposes I need a local project library. I have three scripts...
- NLP and clustering - runs fine with renv
- batch script sourcing 3 - runs fine until it hits problem in 3
- metric builder script with mice and micemd. - displays the following error below
Error in checkForRemoteErrors(val) : **
** 5 nodes produced errors; first error: could not find function "check.deprecated"
Error in checkForRemoteErrors(val) :
5 nodes produced errors; first error: could not find function "check.deprecated"
This part does not always show up.
In addition: Warning messages:
1: In .snowTimingData$running() :
** closing unused connection 37 (<-localhost.localdomain:11306)**
Because of the error I updated R and the packages mice and micemd to current on CRAN, again I get the same issue unless I am using the global library stored in the R program folder.
The packages are in my lockfile, and I used renv::isolate to make sure they are stored locally rather than linked. I also used renv::rebuild(), which resulted in an error in installing MASS, although checking the functions it seems to work fine.
I have managed to get the function to work a few times, like after a clean install of R and Rstudio, but once the other scripts and were run and packages installed the function failed in both the test example below and the batch processes. I have also attempted to specify .libPaths("C:/Users/MY_NAME/Documents/POJ_NAME/prod_lib_v1/renv/library/R-4.2/x86_64-w64-mingw32")
in the ... field of the function, again this did not work. I'm not really sure where to go from here, any advice would be much appreciated?
Thank you for reading
note.
R 4.2
mice 3.14.0
micemd 1.8
windows 10
happy to share the renv lockfile if required
library(tidyverse)
library(micemd)
test2 <- read_rds("test.rds")
test2 %>%
micemd::mice.par(m = 5,
maxit = 30,
method = "pmm",
seed = 29725
)
Data below
test2 <- structure(list(item = structure(c(1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L), .Label = c("ITEM375225",
"ITEM462179"), class = "factor"), prmt_ind = structure(c(1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L), .Label = c("0", "1"), class = "factor"),
sales = c(NA, 5, 11, NA, NA, 7, 10, NA, NA, 1, 10, NA, NA,
1, 13, NA, NA, 3, 21, NA, NA, NA, 28, NA, NA, NA, 24, NA,
NA, 41, 32, NA, NA, 50, 21, NA, NA, 55, 18, NA, NA, 47, 15,
NA, NA, 56, 21, NA, NA, 64, 17, NA, NA, 56, 15, NA, NA, 44,
17, NA, NA, 48, 21, NA, NA, 41, 14, NA, NA, 40)), row.names = c(NA,
-70L), class = c("tbl_df", "tbl", "data.frame"))