View source: R/utils-parallel.R
lapply_async | R Documentation |
lapply
using future package in asynchronous waylapply
using future package in asynchronous way
lapply_async(
x,
fun,
...,
.ncores = 0,
.call_back = NULL,
.packages = NULL,
.envir = environment(),
.globals = TRUE,
.gc = TRUE,
.as_datatable = FALSE,
.nrows = 0
)
lapply_async3(
x,
fun,
...,
.globals = TRUE,
.gc = TRUE,
.callback = NULL,
.ncores = 0
)
x , fun , ... |
(See |
.ncores |
Number of cores to use. If the value is 0, the number of cores will be determined by rave_options('max_worker'). |
.call_back |
A function takes current iteration number as argument, can be NULL. |
.packages |
NULL be default, then the function will detect attached packages automatically. Otherwise you have to specify the packages that you want to load. |
.envir |
internally used |
.globals |
Automatically detect variables. See ?future::future |
.gc |
Clean up environment after each iterations? Recommended for large datasets. |
.as_datatable |
logical, return result as |
.nrows |
integer, if |
.callback |
function or |
## Not run:
lapply_async(1:10, function(x){
Sys.sleep(2) # Run for 1 secs
Sys.getpid()
}, .ncores = 3, .call_back = function(i){
cat('Running iteration -', i, '\n')
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.