Skip to content

Commit c6c1442

Browse files
future global option
1 parent 1309eb7 commit c6c1442

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

R/modelsummary.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ get_list_of_modelsummary_lists <- function(models, conf_level, vcov, gof_map, sh
702702
# {future}
703703
} else if (isTRUE(check_dependency("future.apply")) &&
704704
future::nbrOfWorkers() > 1 &&
705-
number_of_models > 1) {
705+
number_of_models > 1 &&
706+
isTRUE(getOption("modelsummary_future", default = TRUE))) {
706707
out <- future.apply::future_lapply(seq_len(number_of_models), inner_loop, future.seed = TRUE)
707708

708709
# sequential

man-roxygen/modelsummary_parallel.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
#' ```{r, eval = FALSE}
1919
#' library(future.apply)
2020
#' plan(multicore, workers = 4)
21+
#' options("modelsummary_future" = TRUE)
2122
#' modelsummary(model_list)
2223
#' ```
2324
#'
2425
#' Note that the "multicore" plan only parallelizes under mac or linux. Windows
25-
#' users can use `plan(multisession)' instead. However, note that the first
26+
#' users can use `plan(multisession)` instead. However, note that the first
2627
#' time `modelsummary()` is called under multisession can be a fair bit longer,
2728
#' because of extra costs in passing data to and loading required packages on
2829
#' to workers. Subsequent calls to `modelsummary()` will often be much faster.
2930
#'
31+
#' Some users have reported difficult to reproduce errors when using the
32+
#' `future` package with some packages. The `future` parallelization in
33+
#' `modelsummary` can be disabled by calling:
34+
#'
35+
#' `options("modelsummary_future" = FALSE)`

man/modelsummary.Rd

+11-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/msummary.Rd

+11-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)