makeREvaluator | R Documentation |
Make a function that evaluates an expression in an R-language intepreter.
makeREvaluator(RProgName, RHome = NULL, RBinDir = NULL, startFlags = NULL, envVars = NULL, interpreterType = sub("[^[:alpha:]].*$", "", toupper(basename(RProgName))), arch = NULL) configureREvaluator(evaluator, FullPath, startFlags = NULL, envVars = NULL, arch = NULL, nonUNCDir) ## S3 method for class 'REvaluator' print(x, complete = FALSE, ...)
RProgName |
a character string giving the name of the R interpreter. |
RHome |
a character string giving the home directory of the R interpreter. |
startFlags |
a character string giving command line arguments to the R interpreter.
These are appended to the default command line arguments
|
envVars |
a named vector of character strings specifying the names and values of
environment variables to set before spawning the R interpreter. A value
of |
RBinDir |
a character string giving the bin directory of the R interpreter.
If not given and |
interpreterType |
either |
arch |
a character string (or |
x |
the |
complete |
a logical value. If |
... |
other arguments to print for |
evaluator |
the |
FullPath |
a string specifying the full file path to the open-source R or \TERR executable. The default values
come from |
nonUNCDir |
a string giving the full name of a directory, in the "diskLetter:/..." format, not the UNC "//machine/..." format,
that will be used on Windows to launch the cmd.exe subprocess from.
No files will be accessed in this directory and the R or TERR subprocess will revert to the directory used
by the calling process before running the requested expressions;
Windows cmd.exe needs to start in a directory whose name starts with a letter then a colon.
If it is the empty string the subprocess will be launched from the current directory.
The default value on Windows is the first of |
returns a function that starts an R interpreter
in a new process, evaluates the expression there,
and gets the result when the interpreter is done.
See REvaluator
for a description of the function.
The REvaluator
functions store important values in their associated environments.
(These values include the full file path of the executable to be called, along with the
arguments to the function. Also, if you used the envVars
argument when you made
or configured the object to set environment variables, the result of that is stored as well.
This is useful information if you examine the default evaluators, REvaluator
and
TERREvaluator
, because it conveys the results of the autoconfiguration.)
These values are not printed by the default print
method.
To display these values, call the appropriate REvaluator
function's print
method.
configureREvaluator
is called from the .onLoad
function for the RinR package,
unless you set options(RinR_DONT_CONFIGURE=TRUE)
. In that case, or if the full
paths to the open-source R and \TERR executables cannot be found, the default evaluators assume
that executables called "R" and "TERR" are in a directory in Sys.getenv("PATH")
.
If configureREvaluator
cannot find the full file path to the open-source R or \TERR
executables from the default values specified in options("RinR_R_FULL_PATH")
or
options("RinR_TERR_FULL_PATH")
, configureREvaluator
searches the Windows registry
and commonly-used places in the file system to find where open-source R and \TERR are installed.
If that search is not successful, configureREvaluator
uses a path based on the value of R.home()
when configuring the evaluator whose type matches the type of currently running program.
If all else fails, RinR uses "R" for the standard REvaluator
and "TERR" for the standard
TERREvaluator
. Its success depends on whether you reconfigured or used pushPATH
to ensure executables by those names are on the system PATH before you use the evaluators.
configureREvaluator
modifies the evaluator; it returns nothing useful.
REvaluate
, RCompare
## Not run: R2.15.1 <- makeREvaluator("R", RHome="C:/Program Files/R/R-2.15.1") REvaluate(version, REvaluator=R2.15.1) R3.0.1 <- makeREvaluator("R-3.0.1", envVars=c(R_LIBS_SITE="/tmp")) R3.0.1 REvaluate(.libPaths(), REvaluator=R3.0.1) configureREvaluator(REvaluator, FullPath="C:/Program Files/R/R-3.0.1/bin/R") REvaluator ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.