Utility to use different implementations of lapply
.
util_lapply(FUN, args, par = TRUE, ncores = NULL)
FUN | Function to apply. |
---|---|
args | Named list.
Arguments to pass to |
par | Logical.
If |
ncores | Integer.
Number of cores to use if |
util_lapply( FUN = rnorm, args = list( n = rep(x = 5, times = 5), mean = 100, sd = 15 ), par = FALSE )#> [[1]] #> [1] 78.99935 103.82976 63.44105 99.91643 109.32329 #> #> [[2]] #> [1] 117.22617 72.67274 96.29012 96.33701 95.75942 #> #> [[3]] #> [1] 91.69451 109.43473 130.97537 75.53516 107.68640 #> #> [[4]] #> [1] 72.05483 92.16981 99.21097 108.14495 86.28888 #> #> [[5]] #> [1] 107.02232 105.44427 80.43185 111.06664 128.32757 #>