[R] can Rgui.exe be launched with a script as an argument?

Bill Bachman bachmanw at comcast.net
Wed Nov 8 18:23:07 CET 2006

Ultimately, I would like to launch R (from another application) with a
script as an argument that creates a plot.  I am running on Windows XP with
R 2.4.0.  I currently can do this with S-Plus from my application by giving
this command:

“C:\Program Files\Insightful\splus62\cmd\splus.exe”  S_PROJ=”C:\myproject”

I would like to be able to port my scripts to R and use R to keep costs low
for academics, etc.

The closest that I have been able to come to doing this in R is to create a
.First function:

.First <- function() source("test.R”)

The test.R file contains the following lines:


The error on launching rgui.exe with a batch file ("C:\Program
Files\R\R-2.4.0\bin\Rgui.exe " -–quiet) is:

Error in eval.with.vis(expr, envir, enclos) : 
        could not find function "plot"

(any other high level function also does not work)

Any suggestions greatly appreciated.


More information about the R-help mailing list