REvaluator
Evaluates an R Expression in a Given R-language Interpreter

Description

Evaluate an R-language expression in open-source R, in Spotfire 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.
  • If data is a character vector, objects by those names are copied from envirData to the interpreter and environment where expr is evaluated.
  • If data is a named list, the components are copied to the target environment to be stored under their names in the list.

    These data objects are available when expr is evaluated.

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, LocalEvaluatorreturn 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.
REvaluatereturns 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
See Also
RCompare, RGraph, pushPATH, multiREvaluator, makeREvaluator.
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)

Package RinR version 6.1.4-13
Package Index