renv package management with mice and micemd

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

  1. NLP and clustering - runs fine with renv
  2. batch script sourcing 3 - runs fine until it hits problem in 3
  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"))

Thanks for the bug report! Unfortunately, I wasn't able to reproduce (using renv 0.15.4 and R 4.2.0 on Windows). Can you provide any other details?

Hi @kevinushey

Thanks for looking in to this, I'm really stuck.

I have saved the lockfile I am using here, I couldn't attach the file in the post as it is not the right type. All was installed with pak. If you need anything else let me know?

I have also used the code below to clear the environment, and detach packages, before recalling: tidyverse, mice and micemd to the session before applying the code above.

Probably worth mentioning that the first time I ran renv for this project windows defender came up to allow rstudio access past the firewall, which I granted . Haven't seen it since, so I did not think it was an issue.

# CLEAR R SESSION
clc <- function() {
  rm(list = ls(envir = globalenv()),envir = globalenv()) #clear Vars from global enviroment
  gc()  #grabage colector
  cat("\014") #clc
  .rs.restartR() #clear session
}

clc()

# DETACH PACKAGES
base::detach("tidyverse")
invisible(lapply(paste0("package:", names(sessionInfo()$otherPkgs)),   # Unload add-on packages
                 detach,
                 character.only = TRUE, unload = TRUE))
(.packages()) 

Can you please file a bug report at Issues · rstudio/renv · GitHub, just so this doesn't get lost? I unfortunately still don't have a great idea as to what's going on but hopefully will get time to investigate again soon.

Sure, I'll do it as soon as I have a few mins.

Thank you.

This topic was automatically closed 21 days after the last reply. 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.