REvaluator
Evaluates an R Expression in a Given R-language Interpreter
Description
Evaluate an R-language expression in open-source R,
in TIBCO Enterprise Runtime for R,
or in the currently-running R-language interpreter. Returns the result to the
currently-running interpreter.
Usage
LocalEvaluator(expr, substitute = TRUE, data = NULL, envirData = parent.frame(),
verbose = FALSE, showTextOutput)
TERREvaluator(expr, substitute = TRUE, data = NULL, envirData = parent.frame(),
verbose = FALSE, showTextOutput = FALSE)
REvaluator(expr, substitute = TRUE, data = NULL, envirData = parent.frame(),
verbose = FALSE, showTextOutput = FALSE)
REvaluate(expr, REvaluator. = RinR::REvaluator, substitute = TRUE, data = NULL,
envirData = parent.frame(), verbose = FALSE, packages = character(), ...)
Arguments
expr |
an expression to be evaluated in the given R intepreter.
|
substitute |
a logical value.
- If TRUE (the default), the unevaluated expr is sent to
the other interpreter to be evaluated.
- If FALSE, the unevaluated expr is evaluated before being sent to the
other interpreter. In this latter case, the evaluated expression
must also be a language object. FALSE makes it easier to
call this function from another function.
|
data |
if NULL (the default), no data is passed to the target environment.
If not NULL, data should be either a character vector
or a list with named components.
|
envirData |
an environment. If data is a character vector, then it is assumed
to name objects in this environment. Otherwise envirData is not used.
|
verbose |
a logical value. If TRUE, these functions print debugging
information as they run. The default is FALSE.
|
REvaluator. |
an REvaluator object, as created by the makeREvaluator function.
The default, REvaluator, evaluates the expression in open-source R.
|
packages |
A character vector (or NULL) giving the names of the packages to load
before evaluating expr.
|
showTextOutput |
A logical value. If TRUE then text output produced when the REvaluator
evaluates expr will be displayed as it is produced. If FALSE,
the default, such test output will not be displayed unless there is an error
finding the R or TERR executable. RinR::LocalEvaluator does not use
this argument: it always displays the printed output.
|
... |
REvaluate will pass any arguments it does not recognize to the
REvaluator that it invokes.
|
Value
REvaluator, TERREvaluator, LocalEvaluator | return
the value of the the evaluated expression,
placed in a list (of length 1) with version$version.string
(sometimes shortened) of the interpreter for a name. |
REvaluate | returns the value of the the evaluated expression
in the given R interpreter. If an error occurs while that interpreter tries
to evaluate the expression, REvaluate calls stop with the error message
from the interpreter. |
Note
- The LocalEvaluator evaluates the expression in the global environment
of the currently-running R interpreter. Assignments made in the course of
evaluating the expression or copying the data object affects the global environment.
- multiREvaluator evaluates the same expression in several
interpreters.
- RCompare calls multiREvaluator and compares the results
by calling all.equal on them.
- The open-source R and TIBCO Enterprise Runtime for R evaluators are constructed by makeREvaluator.
These are default evaluators containing only the name of the interpreter,
not the path to them. Call pushPATH to add the directory containing
the interpreter's executable to the system PATH variable.
See Also
Examples
## Not run:
REvaluate(version$version.string, LocalEvaluator)
REvaluate(version$language, REvaluator)
REvaluate(version$language, TERREvaluator)
REvaluate(log2(p), TERREvaluator, data=list(p=16:32))
p <- 60:67
REvaluate(log2(p), REvaluator, data="p")
REvaluate({ cat("Hello from subprocess\n"); 1+2+3})
REvaluate({ cat("Hello from subprocess\n"); 1+2+3}, showTextOutput=TRUE)
polrFit <- REvaluate({library(MASS) ; polr(voice.part ~ height, sng)},
data = list(sng = Sdatasets::singer))
## End(Not run)