From 0bb3a85a51943a046a4dd70181c299e1e75c3e59 Mon Sep 17 00:00:00 2001 From: Henrik Bengtsson Date: Mon, 23 Nov 2020 19:01:41 -0800 Subject: [PATCH] BUG FIX: Make sure %dorng% works also when 'foreach' is not attached (fix #18) Secured also two other do.call() instances that called a function by string rather than by function object --- R/doRNG.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/doRNG.R b/R/doRNG.R index f829ca9..20f1493 100644 --- a/R/doRNG.R +++ b/R/doRNG.R @@ -186,7 +186,7 @@ getDoBackend <- function(){ } setDoBackend <- function(backend){ ob <- getDoBackend() - do.call('setDoPar', backend) + do.call(setDoPar, backend) invisible(ob) } @@ -371,7 +371,7 @@ setDoBackend <- function(backend){ # generate a sequence of streams # print("before RNGseq") # showRNG() - obj$args$.doRNG.stream <- do.call("doRNGseq", c(list(n=N_elem, verbose=obj$verbose), rngSeed)) + obj$args$.doRNG.stream <- do.call(doRNGseq, c(list(n=N_elem, verbose=obj$verbose), rngSeed)) # print("after RNGseq") # showRNG() #print(obj$args$.doRNG.stream) @@ -429,7 +429,7 @@ setDoBackend <- function(backend){ substitute(ex))) # call the standard %dopar% operator - res <- do.call('%dopar%', list(obj, ex), envir=parent.frame()) + res <- do.call(`%dopar%`, list(obj, ex), envir=parent.frame()) # add seed sequence as an attribute (skip this for NULL results) if( !is.null(res) ){ attr(res, 'rng') <- obj$args$.doRNG.stream