Problems with doParallel and pROC
I'm trying the examples of MUVR
on an Rstudio server installation using packrat
to manage my project. I had problems ejecuting MUVR
, as I was getting the following error
Error in e$fun(obj, substitute(ex), parent.frame(), e$data): worker initialization failed: there is no package called ‘pROC’
This error seems to be associated with specifying the library location to the foreach
package. See this stackoverflow thread
I was able to fix this by adding clusterCall(cl, function(x) .libPaths(x), .libPaths())
after registerDoParallel()
.
The final chunk of code to execute MUVR
looks as follows:
# Set up parallel processing using doParallel
cl = makeCluster(nCore)
registerDoParallel(cl)
clusterCall(cl, function(x) .libPaths(x), .libPaths())
# Perform modelling
classModel = MUVR(X=Xotu, Y=Yotu, nRep=nRep, nOuter=nOuter, varRatio=varRatio, method=method)
# Stop parallel processing
stopCluster(cl)
Adding this to the documentation would be of great help.