Executes a function call in webR and returns the result. This is useful for running R computations in a sandboxed environment while passing data between the host R session and webR.
Usage
rw_do_call(
what,
args = list(),
quote = FALSE,
r_libs = NULL,
binds = NULL,
shims = NULL,
timeout = 0,
vanilla = FALSE,
debug = FALSE
)Arguments
- what
(function) The function to call.
- args
(list) A list of arguments to pass to the function.
- quote
(logical) If
TRUE, the arguments inargsare quoted and not evaluated before being passed to webR. Default isFALSE.- r_libs
(character string) Path to an R package library on the host to mount in webR. The recommended path is
rw_r_libs_user().- binds
(named character vector) Host directories to mount in webR. Names are the webR mount paths, values are the host paths. For example,
c("/host/data" = "/path/to/data").- shims
(character vector) Shims to install in R. Default is
"install.packages". Set tocharacter(0)to disable.- timeout
(numeric) Maximum execution time in seconds. If exceeded, an interrupt signal is sent to R. Use 0.0 (default) for no timeout.
- vanilla
(logical) If
TRUE, run R with--vanillaflag.- debug
(logical) If
TRUE, output debug information.
Details
This function works by:
Saving the function and arguments to an RDS file in a staging directory
Using prologue code to load the data in webR
Executing the function call as the main code
Using epilogue code to save the result to an RDS file
Reading the result back into the host R session
See also
Internally, rw() is used.