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

Bill Bachman bachmanw at comcast.net
Wed Nov 8 21:35:35 CET 2006


Thank you to Paul Murrell for a solution:

# test.R
require(graphics)
a<-c(1,2,3,4)
b<-c(1,4,9,16)
plot(a,b) 

-----Original Message-----
From: Lanre Okusanya [mailto:lanre.okusanya at gmail.com] 
Sent: Wednesday, November 08, 2006 1:04 PM
To: Bill Bachman
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] can Rgui.exe be launched with a script as an argument?

I assume this is windoze. Have you considered using the Rterm? You can have
in your script the plot to be created as an eps file

Lanre

Bill Bachman wrote:
> 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"
> "C:\myproject\myscript.ssc"
>
> 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:
>
> a<-c(1,2,3,4)
> b<-c(1,4,9,16)
> plot(a,b)
>
> 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.
>
> Thanks,
> Bill
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



More information about the R-help mailing list