Execute a task in parallel akin to parallel::parSapply()
.
Usage
UserApiConsumer$sapply(backend, x, fun, ...)
Arguments
backend
An object of class Backend
as returned by
the start_backend()
function. It can also be NULL
to run
the task sequentially via base::sapply()
.
x
An atomic vector or list to pass to the fun
function.
fun
A function to apply to each element of x
.
...
Additional arguments to pass to the fun
function.
Returns
A vector of the same length as x
containing the results of the
fun
. The output format resembles that of base::sapply()
.
Execute a task in parallel akin to parallel::parLapply()
.
Usage
UserApiConsumer$lapply(backend, x, fun, ...)
Arguments
backend
An object of class Backend
as returned by
the start_backend()
function. It can also be NULL
to run
the task sequentially via base::lapply()
.
x
An atomic vector or list to pass to the fun
function.
fun
A function to apply to each element of x
.
...
Additional arguments to pass to the fun
function.
Returns
A list of the same length as x
containing the results of the fun
.
The output format resembles that of base::lapply()
.
Execute a task in parallel akin to parallel::parApply()
.
Usage
UserApiConsumer$apply(backend, x, margin, fun, ...)
Arguments
backend
An object of class Backend
as returned by
the start_backend()
function. It can also be NULL
to run
the task sequentially via base::apply()
.
x
An array to pass to the fun
function.
margin
A numeric vector indicating the dimensions of x
the
fun
function should be applied over. For example, for a matrix,
margin = 1
indicates applying fun
rows-wise, margin = 2
indicates applying fun
columns-wise, and margin = c(1, 2)
indicates applying fun
element-wise. Named dimensions are also
possible depending on x
. See parallel::parApply()
and
base::apply()
for more details.
fun
A function to apply to x
according to the margin
.
...
Additional arguments to pass to the fun
function.
Returns
The dimensions of the output vary according to the margin
argument.
Consult the documentation of base::apply()
for a detailed
explanation on how the output is structured.
Method clone()
The objects of this class are cloneable with this method.
Usage
UserApiConsumer$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.