Enhanced R Script

Enhanced R Script

EnhancedRScript.py is a Python script intended as an easy interface between the Discovery Environment and R scripts. The Python command line can be used to modify a specially-designed R script before executing that modified R script.

EnhancedRScript scans an R script for any parameter names surrounded by two dollar signs on both sides, e.g, $$name$$ or $$myvar$$. Those parameter names can then be options on the EnhancedRScript command line, with the parameters replaced by command line options. For example, "$$name$$" would be replaced by the --name= option value on the EnhancedRscript command line. Defaults are also supported, and EnhancedRScript can also generate a script without executing it for debugging purposes. The Rscript command can, of course, pass parameters to an R script as well, but the Python wrapper is intended to provide more flexibility in some respects.

The basic Enhanced R Script application in the Discovery Environment is intended as a demonstration and can run scripts without the parameters as described above. To run scripts with replacement parameters, create a new Discovery Environment application. Examples include Linear Regression in R and Generalized Linear Regression in R.

Usage

./enhancedRScript.py <R_script_file> <options>

Arguments

<R_script_file>

Filename or full path to the script file to be processed. See below for special considerations.

Internal Options

These command line options are for EnhancedRScript itself and are not used for substitutions. All future internal options will begin with an underscore.

--_scriptonly

Generate the output script and print to the standard output. Do not run