From bcea35ca36c5fcd46b73c98c8450a09e5990642a Mon Sep 17 00:00:00 2001
From: Francesco Sabatini <francesco.sabatini@idiv.de>
Date: Fri, 24 Apr 2020 10:21:06 +0200
Subject: [PATCH] updated 01b

---
 01b_MesobromionCluster.R | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R
index 7ce21b2..413638d 100644
--- a/01b_MesobromionCluster.R
+++ b/01b_MesobromionCluster.R
@@ -142,17 +142,17 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
         }
       
       ## Divide in chunks if requested
-      if(chunkn>1){
-        print(paste("nround", nround, "--- divide in", chunkn, "chunks"))
-        indices <- 1:length(allcomb.t)
-        chunks <- split(indices, sort(indices%%chunkn))
-      }  else {chunks <- list(1:length(allcomb.t))}
-      #names.t <- unlist(lapply(allcomb.t, paste, collapse="_"))
+#      if(chunkn>1){
+#        print(paste("nround", nround, "--- divide in", chunkn, "chunks"))
+#        indices <- 1:length(allcomb.t)
+#        chunks <- split(indices, sort(indices%%chunkn))
+#      }  else {chunks <- list(1:length(allcomb.t))}
+#      #names.t <- unlist(lapply(allcomb.t, paste, collapse="_"))
       
       ## start main foreach loop
       print(paste("Start main loop - round", nround))
-      corXY.output <- foreach(ch=chunks, .combine=rbind) %myinfix% {
-        allcomb.i <- allcomb.t[unlist(ch)]
+      corXY.output <- foreach(ch=1:length(allcomb.t, .combine=rbind) %myinfix% {
+        allcomb.i <- allcomb.t[ch]
         print(paste("Running on", length(allcomb.i),"out of", nall, "combinations"))
         
         for(i in 1:length(allcomb.i)){
-- 
GitLab