multiREvaluator
Evaluates an Expression in One or More R-language Interpreters

### Description

Evaluates an R-language expression in one or more R-language interpreters and optionally compares the results.

### Usage

    RCompare(expr, REvaluators = DefaultREvaluators(), substitute = TRUE,
        data = NULL, envirData = parent.frame(), tolerance = 0,
        returnValues = TRUE, verbose = FALSE, randomCheck = FALSE, ...)
    multiREvaluator(expr, REvaluators = DefaultREvaluators(), substitute = TRUE,
        data = NULL, envirData = parent.frame(), verbose = FALSE,
        sideBySide = TRUE, PRINTFUN = "print", randomCheck = FALSE, ...)
    DefaultREvaluators()

### Arguments

expr | an expression to evaluate.
REvaluators | a list of REvaluator objects as created by the makeREvaluator function. The defaults evaluate the expressions in open-source R and Spotfire Enterprise Runtime for R.
substitute | a logical value. Specifies how to use the expr argument. 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. The evaluated expression must also be a language object. Setting subsitute to FALSE makes it easier to call this function from another function.
data | if not NULL, then either a character vector or a named list specifying the objects that must be put into the environment where expr is evaluated. See TERREvaluator for details.
envirData | the environment where items in the character vector data are found.
verbose | a logical value. If TRUE, debugging information is printed. The default is FALSE.
tolerance | a small positive numeric value that is passed to all.equal to specify how far apart two numeric results must be before a difference is reported.
returnValues | a logical value. If TRUE (the default), then RCompare returns a list containing the results of all the evaluations, along with a list describing how each result (except the first) differs from the first. If FALSE, it returns only the description of the differences.
sideBySide | a logical value. If TRUE (the default), then give the output of multiEvaluator the class "sideBySide" so the output components are printed next to each other, if possible.
PRINTFUN | a function or the name of a function. This is passed to sideBySide to specify how to print the output components.
randomCheck | a logical value. If TRUE, an attribute "usedRandomSeed" is added to the output to indicate if random numbers were used during the requested calculations. If FALSE, that information is not returned. The check determines if .GlobalEnv$.Random.seed changes during the calculations. Note that code calling set.seed() can cause randomCheck to report a false negative.
... | multiREvaluator and RCompare will pass any unrecognized arguments to the REvaluators that they invoke.

Value

multiREvaluator | returns a list of the results of evaluating the expression in each R interpreter. The names of the list are taken from version$version.string in each interpreter. The returned list has the class "sideBySide", whose print method attempts to print the outputs beside each other for easier visual comparison. If the argument randomCheck is TRUE, then the output includes an attribute, usedRandomSeed, which is a logical vector with one element per evaluator indicating whether random numbers are used in the calculations on each evaluator.
RCompare | usually returns the same value as multiEvaluator, with the addition of the attribute all.equal, describing the differences between the results.
RCompare(..., returnValues) | returns just the list of differences.
DefaultREvaluators | returns getOption("REvaluators") if it is a list of "REvaluator" objects. Otherwise, it returns list(RinR::REvaluator, RinR::TERREvaluator), two of the built-in REvaluators.

See Also
makeREvaluator, TERREvaluator, sideBySide
Examples

    ## Not run:
    RCompare(log2(xTest), data = list(xTest=4:16))
    RCompare(lm(hp ~ gear + am, data=mtcars), REvaluators=list(REvaluator, LocalEvaluator), tol=1e-12)
    myData <- subset(iris, Species == "setosa", -Species)
    RCompare(prcomp(myData), data = "myData")
    RCompare(kmeans(cbind(sin(1:10), cos(1:10)), 3), randomCheck=TRUE)

    ## End(Not run)

Package RinR version 6.1.5-18
Package Index