public class Renjin
extends java.lang.Object
RenjinTask capable of executing any function or script
within
Renjin-compatible R packages,
use the following builder pattern:
RenjinTask rTask = Renjin.R().code(rCode).input(rInput).build();
The executable R code for the task is specified using the
code(...) methods.
One or more data inputs are passed on an executable R task using the
input(...)
methods.
If your application runs in a single JVM environment use the
Renjin.R() method when building your executable R tasks.
If your application runs within a distributed cluster environment use
the Renjin.R(boolean, boolean)
method as appropriate when creating your executable R tasks.
| Modifier and Type | Method and Description |
|---|---|
RenjinTask |
build()
Create an instance of an executable R task.
|
RenjinTask |
build(javax.script.ScriptEngine suppliedEngine)
Create an instance of an executable R task.
|
RenjinTask |
build(javax.script.ScriptEngine suppliedEngine,
boolean autoClearSuppliedEngine)
Create an instance of an executable R task.
|
Renjin |
code(java.io.Reader code)
Specify the R code for the executable R task.
|
Renjin |
code(java.lang.String code)
Specify the R code for the executable R task.
|
Renjin |
input(java.util.Map<java.lang.String,java.lang.Object> nameValues)
Specify data inputs for the executable R task.
|
Renjin |
input(java.lang.String name,
java.lang.Object value)
Specify a data input for the executable R task.
|
static Renjin |
R()
Create an instance of a Renjin task builder.
|
static Renjin |
R(boolean serializableTasks,
boolean serializableResults)
Create an instance of a Renjin task builder.
|
static javax.script.ScriptEngine |
scriptEngine()
Renjin
ScriptEngine factory. |
public static Renjin R()
public static Renjin R(boolean serializableTasks, boolean serializableResults)
RenjinResult from an Apache Spark executor to the
Apache Spark driver, then enable the serializableResults
parameter.serializableTasks - enable for RenjinTask serializationserializableResults - enable for RenjinResult serializationpublic Renjin code(java.lang.String code) throws RenjinException
code - the R code to execute on the RenjinTaskRenjinException - if R code provided is nullpublic Renjin code(java.io.Reader code) throws RenjinException
code - the R code to execute on the RenjinTaskRenjinException - if Reader provided could not be readpublic Renjin input(java.lang.String name, java.lang.Object value) throws RenjinException
name - data input namevalue - data input valueRenjinException - if input data could not be serializedpublic Renjin input(java.util.Map<java.lang.String,java.lang.Object> nameValues) throws RenjinException
nameValues - a Map of data input name-value pairs.RenjinException - if input data could not be serializedpublic RenjinTask build() throws RenjinException
RenjinTaskRenjinException - if executable R task definition is incompletepublic RenjinTask build(javax.script.ScriptEngine suppliedEngine) throws RenjinException
suppliedEngine - a ScriptEngine supplied by
the calling application to use when executing the taskRenjinTaskRenjinException - if RenjinTask definition is incompletepublic RenjinTask build(javax.script.ScriptEngine suppliedEngine, boolean autoClearSuppliedEngine) throws RenjinException
suppliedEngine - a ScriptEngine supplied by
the calling application to use when executing the task
ScriptEngine on which to
execute the R taskautoClearSuppliedEngine - enable if the suppliedEngine bindings
and workspace should be cleared following R task executionRenjinTaskRenjinException - if RenjinTask definition is incompletepublic static javax.script.ScriptEngine scriptEngine()
ScriptEngine factory. Provided as
a convenience method where external control over the Renjin
runtime environment is required. Intended to be used in
conjunction with the
build(ScriptEngine) and the
build(ScriptEngine, boolean) methods.ScriptEngine