Skip to contents

lapply_flex

Usage

lapply_flex(
  X,
  FUN,
  method = c("future", "biocparallel"),
  cores = NA,
  future.seed = TRUE,
  BPPARAM = NULL,
  fun = NULL,
  ...
)

Arguments

X

list to use

FUN

function to be performed

method

character. Either "future" or "biocparallel", determining which parallelization framework to use.

cores

deprecated

future.seed

whether to set a seed when using method = "future"

BPPARAM

a BiocParallel parameter class deciding how to perform parallelized or sequential (default) evaluation. Used with method = "biocparallel"

fun

deprecated. Backwards compatibility for FUN

...

other arguments to pass

Value

list

Examples

lapply_flex(list(x = 1, y = 2), FUN = log)
#> Warning: Your code is running sequentially. For better performance, consider using a
#>  parallel plan like:
#>  future::plan(future::multisession)
#> 
#>  To silence this warning, set options("giotto.warn_sequential" = FALSE)
#> $x
#> [1] 0
#> 
#> $y
#> [1] 0.6931472
#> 

# suppress warnings
options("giotto.warn_sequential" = FALSE)

lapply_flex(list(x = 1, y = 2), FUN = log, method = "future")
#> $x
#> [1] 0
#> 
#> $y
#> [1] 0.6931472
#> 

lapply_flex(list(x = 1, y = 2), FUN = log, method = "biocparallel")
#> Error: package 'BiocParallel' is not yet installed
#> 
#>  To install:
#> if(!requireNamespace('BiocManager', quietly = TRUE)) install.packages('BiocManager');
#> BiocManager::install(c("BiocParallel"))