It is easier to call postscript() explicitly in your script, as the R
tests scripts do (and many of the package scripts, e.g. those under MASS).
On Wed, 17 May 2006, Stephen Eglen wrote:
>
> I often use R CMD BATCH to run my files (e.g. script.R), and get the
> output recorded in script.Rout -- this is great. On my setup (R.2.3.0
> on linux), if any plots are created, they get stored in Rplots.ps.
> This can get confusing if I have several batch scripts in one
> directory.
>
> I've written a simple shell script to rename Rplots.ps to
> e.g. script.Rout.ps so that later I can easily identify which script
> created the original postscript file. Just thought I'd share it in
> case others were interested, or had comments.
>
> Stephen
> ----------------------------------------------------------------------
> #!/bin/sh
> ## Run R in BATCH mode.
>
> ## Usage:
> ## rb infile
>
> ## First (and only argument) is the R script to run in batch.
> in=${1}
>
> ## Check that the input file exists.
> if [ -r ${in} ]
> then
> ## I do not like .RData to be saved
> R CMD BATCH --no-save ${in}
> else
> echo "File ${in} does not exist."
> exit -1
> fi
>
> ## if Rplots.ps is readable, rename it to X.Rout.ps
> if [ -r Rplots.ps ]
> then
> outps=`basename ${in} .R`.Rout.ps
> mv Rplots.ps ${outps}
> fi
>
> ______________________________________________
> 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
>
--
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595