Re: [R] Renaming Rplots.ps from BATCH scripts.

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 17 May 2006 - 22:07:53 EST

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@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@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

______________________________________________
R-help@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
Received on Wed May 17 22:14:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 18 May 2006 - 00:10:13 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.