[Dplr-commits] r1125 - pkg/dplR/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 3 19:19:04 CET 2018


Author: mvkorpel
Date: 2018-11-03 19:19:04 +0100 (Sat, 03 Nov 2018)
New Revision: 1125

Modified:
   pkg/dplR/R/detrend.R
Log:
Use a dummy loop to suppress possible warning from sequential %dopar%


Modified: pkg/dplR/R/detrend.R
===================================================================
--- pkg/dplR/R/detrend.R	2018-11-03 17:55:39 UTC (rev 1124)
+++ pkg/dplR/R/detrend.R	2018-11-03 18:19:04 UTC (rev 1125)
@@ -45,12 +45,16 @@
         rwl.i <- NULL
 
         exportFun <- c("names<-", "detrend.series")
-        out <- suppressWarnings(foreach::"%dopar%"(foreach::foreach(rwl.i=it.rwl,
+        ## Use a dummy loop to suppress possible (non-)warning from
+        ## initial call to %dopar% with a sequential backend...
+        foo <- suppressWarnings(foreach::"%dopar%"(foreach::foreach(i=1), {}))
+        ## ... but leave actual warnings on for the real loop.
+        out <- foreach::"%dopar%"(foreach::foreach(rwl.i=it.rwl,
                                                    .export=exportFun),
                               {
                                   names(rwl.i) <- rn
                                   do.call(detrend.series, detrend.args)
-                              }))
+                              })
 
         if (return.info) {
             modelCurves <- lapply(out, "[[", 2)



More information about the Dplr-commits mailing list