RinR
The Spotfire Enterprise Runtime for R RinR Package Overview

### Description

Provides an overview to the RinR package.
Introduction to the RinR Package
The RinR package provides functions for running code in open-source R from Spotfire Enterprise Runtime for R, or running code in Spotfire Enterprise Runtime for R from open-source R. Using RinR, you can:

- Compare results of running the same code in different open-source R and Spotfire Enterprise Runtime for R versions (see RCompare).
- Call a function from an open-source R package and return the results to Spotfire Enterprise Runtime for R (see REvaluate)).
- Use open-source R to create a graphic, and then return the graphic to be displayed in Spotfire or a browser (see RGraph).

Package Functions
MakeREvaluator
Makes a function of class "REvaluator" that evaluates an expression in an R-language intepreter. The created function starts an R interpreter in a new process, evaluates the expression in the global environment of that interpreter, and returns the result in a list when the interpreter is done. The name in the list is derived from the value of version$version.string evaluated in the R-language interpreter.
LocalEvaluator, REvaluator, and TERREvaluator
Standard REvaluator objects like those created by MakeREvaluator and stored in the RinR package. REvaluator and TERREvaluator evaluate the expression in a new R or TERR process, but LocalEvaluator uses the currently running process.
configureREvaluator
Use to configure an existing REvaluator object to change the location of the R or TERR executable or to change some startup options. If you do not supply the location of the executable, RinR tries to find it, based on the values of options("RinR_R_FULL_PATH"), options("RinR_TERR_FULL_PATH"), values in the Windows registry, commonly-used locations in the local file system, and directories in Sys.getenv("PATH"). configureREvaluator is called for each of the built-in REvaluator objects from the .onLoad function for the RinR package (unless you set options(RinR_DONT_CONFIGURE=TRUE)) so there is a good chance you do not have to reconfigure the location or the options.
REvaluate
Evaluates the expression in an R-language interpreter via an REvaluator object and returns its value. If an error occurs while the interpreter tries to evaluate the expression, REvaluate calls stop with the error message from the interpreter. That is, calling REvaluate(expr, REvaluator) acts like calling just expr, except that the evaluation is done in another R-language interpreter.
RGraph
Provides for generating graphics files by passing an expression to open-source R and evaluating it there. Use it to create png, pdf, jpeg, and wmf files.
MultiREvaluator
Evaluates an R-language expression in one or more R-language interpreters, and 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.
RCompare
Returns the same value as multiREvaluator, with the addition of the attribute all.equal, describing the differences between the results.
pushPATH
Adds the specified directory to the front of PATH, so that directory is searched before any others when the system looks for an executable to run. pushPATH returns the value of Sys.getenv("PATH") before it was changed. Altering the path affects nothing outside of Spotfire Enterprise Runtime for R, and is valid only for the current session of Spotfire Enterprise Runtime for R. This is occasionally useful to enable configureREvaluator to find the R or TERR executable.
popPATH
Removes the initial entry from the environment variable PATH. popPATH returns the name of the directory that was removed from PATH. Altering the path affects nothing outside of Spotfire Enterprise Runtime for R, and is valid only for the current session of Spotfire Enterprise Runtime for R.
sideBySide
Makes it easier to compare two or more objects by printing them in side-by-side columns.
Finding the Open-source R and Spotfire Enterprise Runtime for R Engines
By default, using configureREvaluator, RinR configures the two standard evaluators (REvaluator and TERRevaluator) so they know where the R and TERR engines are in the local file system. On both Windows and Linux, configureREvaluator uses getOption("RinR_R_FULL_PATH") and getOption("RinR_TERR_FULL_PATH") to find the open-source R and Spotfire Enterprise Runtime for R executables, respectively. If these options are set, they must specify the full path to the open-source R and the Spotfire Enterprise Runtime for R executables. For example, for open-source R on Windows, this might be "C:/Program Files/R/R-3.0.1/bin/R". For open-source R on Linux, this might be "/usr/local/bin/R-3.0.1". If you set these options, no further configuration is necessary.
To store these configuration options permanently in your Spotfire Enterprise Runtime for R installation, add a line like the following:

|  | options(RinR_R_FULL_PATH="C:/Program Files/R/R-3.0.1/bin/R").

to a TERRprofile startup file (for example, TERR_HOME/etc/TERRprofile.site).
The search strategy for when those options are not set is described in the help file for configureREvaluator.
See Also
configureREvaluator, REvaluate, RCompare, RGraph, pushPATH, multiREvaluator, makeREvaluator, LocalEvaluator, sideBySide.
Examples

    ## Not run:
    REvaluate(version$language, REvaluator)
    REvaluate(version$language, TERREvaluator)
    p <- 60:67
    REvaluate(log2(p), data="p", REvaluator)
    library(Sdatasets)
    polrFit <- REvaluate({library(MASS) ; polr(voice.part ~ height, sng)},
        data = list(sng = Sdatasets::singer))
    RGraph(boxplot(with(singer, split(height, voice.part))),
        data= list(singer = Sdatasets::singer), display = TRUE)

    ## End(Not run)
    ## Not run:
    options(REvaluators = list(REvaluator, TERREvaluator))
    RCompare(lm(hp ~ gear + am, data=mtcars), tol=1e-12)
    myData <- subset(iris, Species == "setosa", -Species)
    RCompare(prcomp(myData), data = "myData")

    ## End(Not run)

Package RinR version 6.1.5-18
Package Index