pa_map_if | R Documentation |
The syntax and the logic of pa_map_if and pa_map_at functions are
identical to purrr's map_if and map_at
functions. Please refer to map_if
if you are not
familiar with purrr mapping style. Except .x, .f, and .p or .at other
arguments are optional and control the parallelization processes.
pa_map_if( .x, .p, ..., .f, .else = NULL, cores = NULL, adaptor = "doParallel", cluster_type = NULL, splitter = NULL, auto_export = TRUE, .export = NULL, .packages = NULL, .noexport = NULL, .errorhandling = "stop", .inorder = TRUE, .verbose = FALSE ) pa_map_at( .x, .at, .f, ..., cores = NULL, adaptor = "doParallel", cluster_type = NULL, splitter = NULL, auto_export = TRUE, .export = NULL, .packages = NULL, .noexport = NULL, .errorhandling = "stop", .inorder = TRUE, .verbose = FALSE )
.x |
A list or atomic vector. |
.p |
A single predicate function, a formula describing such a
predicate function, or a logical vector of the same length as |
... |
Additional arguments passed on to the mapped function. |
.f |
A function, formula, or vector (not necessarily atomic). If a function, it is used as is. If a formula, e.g.
This syntax allows you to create very compact anonymous functions. If character vector, numeric vector, or list, it is
converted to an extractor function. Character vectors index by
name and numeric vectors index by position; use a list to index
by position and name at different levels. If a component is not
present, the value of |
.else |
A function applied to elements of |
cores |
(Optional) Number of cores (i.e. workers) to be used. The default value is: Available CPU cores - 1 |
adaptor |
The foreach adaptor to be used. Available options are:
|
cluster_type |
The Clusters architecture to be used with the selected adaptor. Note that allowed values for this argument depends on the "adaptor" argument:
|
splitter |
(Optional) Explicitly instruct parapurrr how to pass your input elements to the workers. Splitter should be alist where each of its elements is a vector of integers or integer-like numbers (i.e. no decimal points) of the indexes of your input elements. Collectively they should have a one-to-one correspondence with .x indexes. See the Vignettes for further explanation and examples. |
auto_export |
(TRUE (default), FALSE or "all") Should parapurrr export the detected objects used in .f, from the function's calling frame to the workers? Default is set to TRUE for convenience, but to improve the performance, consider turning auto_export off and manually supply the exported variables using .export argument. "all" is the most conservative and yet, potentially resource-demanding option. It will clone the function's calling environment, and export every variable to the workers, whether used or not. |
.export |
character vector of variables to export.
This can be useful when accessing a variable that isn't defined in the
current environment.
The default value in |
.packages |
character vector of packages that the tasks depend on.
If |
.noexport |
character vector of variables to exclude from exporting.
This can be useful to prevent variables from being exported that aren't
actually needed, perhaps because the symbol is used in a model formula.
The default value in |
.errorhandling |
specifies how a task evaluation error should be handled.
If the value is "stop", then execution will be stopped via
the |
.inorder |
logical flag indicating whether the |
.verbose |
logical flag enabling verbose messages. This can be very useful for trouble shooting. |
.at |
A character vector of names, positive numeric vector of
positions to include, or a negative numeric vector of positions to
exlude. Only those elements corresponding to |
Note that except cores, cluster_type, adaptor, auto_export, and splitter, documentation of other arguments, return section, and examples section are automatically imported from purrr and foreach packages.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.