async_expr: Apply R expressions in a parallel way

Description Usage Arguments Details Value

View source: R/parallels.R

Description

Apply R expressions in a parallel way

Usage

1
2
3
4
5
6
7
8
9
async_expr(
  .X,
  .expr,
  .varname = "x",
  envir = parent.frame(),
  .pre_run = NULL,
  .ncore = future::availableCores(),
  ...
)

Arguments

.X

a vector or a list to apply evaluation on

.expr

R expression, unquoted

.varname

variable name representing element of each .X

envir

environment to evaluate expressions

.pre_run

expressions to be evaluated before looping.

.ncore

number of CPU cores

...

passed to future::future

Details

async_expr uses lapply and future::future internally. Within each loop, an item in ".X" will be assigned to variable "x" (defined by ".varname") and enter the evaluation. During the evaluation, function async is provided. Expressions within async will be evaluated in another session, otherwise will be evaluated in current session. Below is the workflow:

Value

a list whose length equals to .X. The value of each item returned depends on whether async is called. See details for workflow.


dipsaus documentation built on Sept. 6, 2021, 5:08 p.m.