I have been trying to run the dredge function on one of my models, however I would like to run the dredge function in parallel to save time considering that I have ~20 variables in my model. So far I'm running into an error in my attempts to run the dredge function in parallel
Here's a working example using data from the palmerpenguins package
library(palmerpenguins)
library(MuMIn)
#create and clean the dataframe
penguin<-penguins
penguin$bill_length_mm<-as.numeric(penguin$bill_length_mm)
penguin$bill_depth_mm<-as.numeric(penguin$bill_depth_mm)
penguin$flipper_length_mm<-as.numeric(penguin$flipper_length_mm)
penguin$body_mass_g<-as.numeric(penguin$body_mass_g)
penguin<-penguins%>% filter(sex!="")
#change the default "na.omit" to prevent models from being fitted to different datasets in case of missing values.
options(na.action = "na.fail")
#make the model
model1<-lm(bill_length_mm~bill_depth_mm+flipper_length_mm+body_mass_g,data=penguin)
#set up cluster for parallel processing
no_cores <- detectCores() - 1
cl <- makeCluster(no_cores)
#load MuMIn package and model1 onto cluster
clusterExport(cl, "model1")
clusterEvalQ(cl, library("MuMIn"))
combinations1<-parLapply(cl,model1,MuMIn::dredge)
#stop parallel
stopCluster(cl)
currently I'm getting the following error when I try to run the parLapply
function: Error in checkForRemoteErrors(val) :
7 nodes produced errors; first error: no 'nobs' method is available
Any ideas how to fix it? Thanks!