Skip to content

Commit

Permalink
Merge pull request #252 from cmansch/main
Browse files Browse the repository at this point in the history
Fixing sim_fixed_n() parallel results return
  • Loading branch information
LittleBeannie authored May 28, 2024
2 parents 1c14025 + a6a1e46 commit 75297a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down
8 changes: 3 additions & 5 deletions R/sim_fixed_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions vignettes/parallel.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 75297a1

Please sign in to comment.