[R] R/Tk from batch file

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Jan 28 13:42:16 CET 2002


On Mon, 28 Jan 2002, David Lucy wrote:

> Dear R-help,
>
> Reccently I've been working on sample size estimates for our forensic
> scientists and have to make the work accessible to them, preferably
> in some Windows based graphical form. The obvious choise was Tk via R,
> so I now have a couple of very nice, user friendly front ends for
> calculating betas and beta-binomials which run equally well under
> Windows and other systems (same code - amazing).
>
> The problem is that the habitual users of windows are going to get
> flummoxed firing up R then sourcing the script files, so what I have
> been trying to do, without success, is link a batch file to run the
> script as a batch without ever seeing the terminal (or gui version in
> windows). Problem is running R as a batch disables graphics plotting,

Not true on Windows, and only true on Unix if R CMD BATCH is used.

> and the toplevel fires up, but then just shuts down again.

Right. So you have to give it something to do, like wait at a prompt
(equally true on Unix).

> Are there any modifying parameters I can pass to R to make it run in the
> background with a graphics device enabled? I've done all the usual
> searches through the archives and FAQ's etc.

1) In non-interactive use the default plotting device is postscript().
So you either want to explicitly open a windows() device, or alter the
option which is set in Rprofile to

if(interactive()) options(device="windows") else options(device = "postscript")

2) I think you want to do all this via a .Rprofile file.
Or set the batch file to set R_PROFILE to point to a suitable file and use
that as the equivalent of Rprofile.site.  Then use rterm --slave and
make the `dos' windows of the batch file come up minimized.



-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list