r_process: External R Process

Description Usage Arguments Details Examples

Description

An R process that runs in the background. This is an R6 class that extends the processx::process class. The process starts in the background, evaluates an R function call, and then quits.

Usage

1
2

See process for the inherited methods.

Arguments

Details

r_process$new creates a new instance. Its options argument is best created by the r_process_options() function.

rp$get_result() returns the result, an R object, from a finished background R process. If the process has not finished yet, it throws an error. (You can use rp$wait() to wait for the process to finish, optionally with a timeout.)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
## List all options and their default values:
r_process_options()

## Start an R process in the background, wait for it, get result
opts <- r_process_options(func = function() 1 + 1)
rp <- r_process$new(opts)
rp$wait()
rp$get_result()

## End(Not run)

r-pkgs/callr documentation built on Dec. 2, 2018, 4:21 a.m.