Skip to content

Commit

Permalink
Add feedback from future devs (#106)
Browse files Browse the repository at this point in the history
Fixes #105

---------

Signed-off-by: Holger Löwe <[email protected]>
Co-authored-by: Daniel Sabanes Bove <[email protected]>
  • Loading branch information
holgstr and danielinteractive authored Jan 11, 2024
1 parent f8e470a commit 43dc43a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- `WeibSurvOS` now does not return an error for large values of t.
- `PWCSurvOS` now does not return an error for large values of t. It also no longer returns values larger than 1. It is significantly faster, based on a closed form calculation instead of numerical integration.
- `getSimulatedData` now also works when there are no transitions from progression to death, similarly for `getOneClinicalTrial` (which now warns if there are no such transitions at all).
- `corPFSOS` now undoes the `future` plan upon function exit.

### Miscellaneous

Expand Down
3 changes: 2 additions & 1 deletion R/corPFSOS.R
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ corPFSOS <- function(data, transition, bootstrap = TRUE, bootstrap_n = 100, conf
trans <- estimateParams(data, transition)
res <- list("corPFSOS" = corTrans(trans))
if (bootstrap) {
future::plan(future::multisession, workers = max(1, parallelly::availableCores() - 1))
oplan <- future::plan(future::multisession, workers = parallelly::availableCores(omit = 1))
on.exit(future::plan(oplan), add = TRUE)
ids <- lapply(1:bootstrap_n, function(x) sample(seq_len(nrow(data)), nrow(data), replace = TRUE))
corBootstrap <- furrr::future_map_dbl(ids, ~ {
furrr::furrr_options(
Expand Down

0 comments on commit 43dc43a

Please sign in to comment.