From 3a35912ed5f40bba340a4af8270fee4e5385a127 Mon Sep 17 00:00:00 2001 From: HeleneBlt Date: Wed, 15 May 2024 13:01:59 +0200 Subject: [PATCH] Fix connexion issue with MAXENT tuning --- R/biomod2_classes_0.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/biomod2_classes_0.R b/R/biomod2_classes_0.R index e4713ca7..9087fcfc 100644 --- a/R/biomod2_classes_0.R +++ b/R/biomod2_classes_0.R @@ -509,6 +509,10 @@ setMethod('BIOMOD.options.dataset', signature(strategy = 'character'), argsval <- bm_Tuning(model = mod, tuning.fun = tuning.fun, do.formula = TRUE, do.stepAIC = TRUE , bm.options = BOM, bm.format = bm.format, calib.lines = calib.lines , metric.eval = ifelse(mod == "MAXENT", "auc.val.avg", "TSS")) + + # To avoid problem with ENMeval and "bad closing" of foreach loop + env <- foreach:::.foreachGlobals + rm(list = ls(name = env), pos = env) } BOD <- new('BIOMOD.options.dataset', BOM, args.values = argsval)