From e1a29098c99b56a5a0ba01e5cf876c5f05cfe694 Mon Sep 17 00:00:00 2001 From: Cole Date: Tue, 28 May 2024 13:38:26 -0400 Subject: [PATCH 1/3] Fixing the `sim_fixed_n()` function to format the results properly for a parallel implementation. Also updating the `.errorhandling` option to `"stop"` to ensure that issues with parallel implementation are flagged as they are written and not hidden in the results. --- R/sim_fixed_n.R | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/R/sim_fixed_n.R b/R/sim_fixed_n.R index f8ca3a4b..99c76902 100644 --- a/R/sim_fixed_n.R +++ b/R/sim_fixed_n.R @@ -252,7 +252,7 @@ sim_fixed_n <- function( results <- foreach::foreach( i = seq_len(n_sim), .combine = "rbind", - .errorhandling = "pass", + .errorhandling = "stop", .options.future = list(seed = TRUE) ) %dofuture% { # Generate piecewise data ---- @@ -369,11 +369,9 @@ sim_fixed_n <- function( results_sim <- rbindlist(addit) results_sim[, sim := i] - setDF(results_sim) - results <- rbind(results, results_sim) - # return(results_sim) + results_sim } - + setDF(results) return(results) } From 443a59cd4554e8623e4cddca483adc3ac157d1d3 Mon Sep 17 00:00:00 2001 From: Cole Date: Tue, 28 May 2024 14:23:13 -0400 Subject: [PATCH 2/3] Updating the parallel vignette to indicate that `sim_gs_n()` also supports the `future` backends. --- vignettes/parallel.Rmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vignettes/parallel.Rmd b/vignettes/parallel.Rmd index 0394309b..d475bcdf 100644 --- a/vignettes/parallel.Rmd +++ b/vignettes/parallel.Rmd @@ -31,6 +31,8 @@ The function `sim_fixed_n()` provides a simulation workflow for a two-arm trial We can vary the parameters of the trial using different functions outlined in the documentation. This function now provides users the opportunity to implement their simulations using the previously described parallel backends to accelerate the computation. +The function `sim_gs_n()` which simulates group sequential designs under a fixed sample size also supports the use of user-defined backends to parallelize simulations in a similar manner. + ## Background Without specifying a backend, `sim_fixed_n()` will execute sequentially. From a6a1e46a2a73309c219b558b9c4935ce9a43aafe Mon Sep 17 00:00:00 2001 From: Cole Date: Tue, 28 May 2024 16:41:51 -0400 Subject: [PATCH 3/3] Updating the DESCRIPTION version to 0.4.1.4 so users can check version because 0.4.1.3 includes known bug. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 84186b52..5706390c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: simtrial Type: Package Title: Clinical Trial Simulation -Version: 0.4.1.3 +Version: 0.4.1.4 Authors@R: c( person("Keaven", "Anderson", email = "keaven_anderson@merck.com", role = c("aut")), person("Yujie", "Zhao", email = "yujie.zhao@merck.com", role = c("ctb","cre")),