alexpkeil1 / qgcomp

QGcomp (quantile g-computation): estimating the effects of exposure mixtures. Works for continuous, binary, and right-censored survival outcomes. Flexible, unconstrained, fast and guided by modern causal inference principles
27 stars 6 forks source link

future::plan(): better approach + don't use 'transparent' #22

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 2 years ago

Hi,

I see that you use for instance:

https://github.com/alexpkeil1/qgcomp/blob/95e0b74adecb8554f1208ecedbc1f97c0acf6141/R/base_surv.R#L626-L632

Please use the following instead:

if (parplan) {
  oplan <- future::plan(strategy = future::multisession)
  on.exit(plan(oplan), add = TRUE)
}

This is the proper way to do it, cf. help("plan", package = "future"). It also avoids using transparent, which should not be used in package code and will eventually be deprecated.

alexpkeil1 commented 2 years ago

Fixed in https://github.com/alexpkeil1/qgcomp/commit/5519045093b88438f9a8baa7ab5f00e8e60a704f

HenrikBengtsson commented 2 years ago

FYI, transparent is also used in the vignette, cf. https://github.com/alexpkeil1/qgcomp/search?q=transparent

alexpkeil1 commented 2 years ago

Fixed in https://github.com/alexpkeil1/qgcomp/commit/e742d511aef10514c48568bfa0fe84a44712149b