R/testthat-helpers.R

Defines functions use_local_plan

use_local_plan <- function(strategy, mc.cores = 2L, env = parent.frame()) {
  old_options <- options(mc.cores = 2)
  withr::defer(options(old_options), envir = env)
  
  old_strategy <- future::plan(strategy)
  withr::defer(future::plan(old_strategy), envir = env)
  strategy
}

Try the sims package in your browser

Any scripts or data that you put into this service are public.

sims documentation built on Sept. 30, 2024, 9:34 a.m.