Not a user-side function. Do not call directly.
Arguments
- command
Language object with R code to run.
- name
Character of length 1, name of the task.
- string
Character of length 1, string representation of the command.
- data
Named list of local data objects in the evaluation environment.
- globals
Named list of objects to temporarily assign to the global environment for the task.
- seed
Integer of length 1 with the pseudo-random number generator seed to set for the evaluation of the task. Passed to the
seed
argument ofset.seed()
if notNULL
. Ifalgorithm
andseed
are bothNULL
, then the random number generator defaults to the recommended widely spaced worker-specific L'Ecuyer streams as supported bymirai::nextstream()
. Seevignette("parallel", package = "parallel")
for details.- algorithm
Integer of length 1 with the pseudo-random number generator algorithm to set for the evaluation of the task. Passed to the
kind
argument ofRNGkind()
if notNULL
. Ifalgorithm
andseed
are bothNULL
, then the random number generator defaults to the recommended widely spaced worker-specific L'Ecuyer streams as supported bymirai::nextstream()
. Seevignette("parallel", package = "parallel")
for details.- packages
Character vector of packages to load for the task.
- library
Library path to load the packages. See the
lib.loc
argument ofrequire()
.
Details
The crew_eval()
function evaluates an R expression
in an encapsulated environment and returns a monad with the results,
including warnings and error messages if applicable.
The random number generator seed, globals
, and global options
are restored to their original values on exit.
See also
Other utility:
crew_assert()
,
crew_clean()
,
crew_deprecate()
,
crew_random_name()
,
crew_retry()
,
crew_terminate_process()
,
crew_terminate_signal()
,
crew_worker()
Examples
crew_eval(quote(1 + 1))
#> $name
#> [1] "unnamed_task_17f265a7ab7e"
#>
#> $command
#> [1] NA
#>
#> $result
#> $result[[1]]
#> [1] 2
#>
#>
#> $seconds
#> [1] 0
#>
#> $seed
#> [1] NA
#>
#> $algorithm
#> [1] NA
#>
#> $status
#> [1] "success"
#>
#> $code
#> [1] 0
#>
#> $error
#> [1] NA
#>
#> $trace
#> [1] NA
#>
#> $warnings
#> [1] NA
#>
#> $launcher
#> [1] NA
#>
#> $worker
#> [1] NA
#>
#> $instance
#> [1] NA
#>