Skip to content

Commit

Permalink
Fixes cl= 'future' with pbreplicate() #71
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Solymos <[email protected]>
  • Loading branch information
psolymos committed Sep 21, 2024
1 parent 428c519 commit 307f333
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 1.7-3, July 16, 2024

* Fixed initial message issue with Shiny (#69).
* Fix: `pbreplicate` was not passing future related arguments (#71).

# Version 1.7-2, June 27, 2023

Expand Down
4 changes: 2 additions & 2 deletions R/pbreplicate.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pbreplicate <-
function (n, expr, simplify = "array", cl = NULL)
function (n, expr, simplify = "array", ..., cl = NULL)
pbsapply(integer(n), eval.parent(substitute(function(...) expr)),
simplify = simplify, cl = cl)
simplify = simplify, ..., cl = cl)
2 changes: 1 addition & 1 deletion man/pbapply.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pbapply(X, MARGIN, FUN, ..., simplify = TRUE, cl = NULL)

pbsapply(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE, cl = NULL)
pbvapply(X, FUN, FUN.VALUE, ..., USE.NAMES = TRUE, cl = NULL)
pbreplicate(n, expr, simplify = "array", cl = NULL)
pbreplicate(n, expr, simplify = "array", ..., cl = NULL)

.pb_env
pbmapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE)
Expand Down
8 changes: 6 additions & 2 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ example(pbapply, run.dontrun = TRUE)
example(pboptions, run.dontrun = TRUE)

## check potential changes in formal arguments
check_args <- function(fun1, fun2, cl=TRUE) {
check_args <- function(fun1, fun2, cl=TRUE, dots=TRUE) {
f1 <- formals(fun1)
f2 <- formals(fun2)
if (!dots) {
f1 <- f1[names(f1) != "..."]
f2 <- f2[names(f2) != "..."]
}
args1 <- names(f1)
args2cl <- names(f2)
args2 <- if (cl)
Expand Down Expand Up @@ -61,7 +65,7 @@ check_args(lapply, pblapply)
check_args(lapply, pbwalk)
check_args(apply, pbapply)
check_args(sapply, pbsapply)
check_args(replicate, pbreplicate)
check_args(replicate, pbreplicate, dots=FALSE) # don't check ...
check_args(tapply, pbtapply)
check_args(eapply, pbeapply)
check_args(vapply, pbvapply)
Expand Down

0 comments on commit 307f333

Please sign in to comment.