[Rd] modification of BATCH

Douglas Grove dgrove at fhcrc.org
Tue Nov 16 23:32:15 CET 2004


Hi,

I'm having a problem (of my own creation) with BATCH.

The current problem (for me):
----------------------------
I'm sloppy.  I work on *nux systems and will type e.g. "R CMD BATCH a*R out"
to avoid typing the full name of some R script of mine.  However,
sometimes I'm overly sloppy and there are multiple files that match
"a*R", so "a*R" turns into e.g. "aa.R ab.R", and the arguments to
BATCH will be "aa.R ab.R out".  BATCH will use aa.R as the input file and
ab.R as the output file, leading to my script ab.R being overwritten.
I then have to plead to my sysadm to restore the file for me.

I've done this often enough that I need to make a modification to BATCH,
and was wondering if anything can be done about this that can be used
generally.  In other words, is there a fix to my problem that would be
usable in general and won't mess up something else?


Solutions:
-----------
A simple solution to this problem is to print a message and exit when
more than 2 arguments are found.  While I don't know why offhand, there's
probably a reason why people would like to pass extra arguments and have
them ignored by BATCH.  If so, this won't work in general.

Something more intelligent would be to examine the first two arguments
and if they both end in .R then issue a message and exit.  I would think
create fewer problems.  I don't think many people are using R scripts to
create other R scripts, and if they are they can always rename them after
they create them.

I'm just going to go for the simple solution for now, but wanted to toss
this issue out in case it might be something that could be integrated
into the official BATCH script.

Thanks,

Doug Grove
Statistical Research Associate
Fred Hutchinson Cancer Research Center
Seattle, WA



More information about the R-devel mailing list