[Rd] modification of BATCH

Douglas Grove dgrove at fhcrc.org
Thu Nov 18 19:04:21 CET 2004


No problem.  I wasn't sure if there were std. situations in which
extraneous arguments (i.e. arguments not meant to be interpretted
by R or BATCH) would be passed.  In that case it would not be a
big deal to put an error check on this. 

I've modified my version of BATCH to handle my issues, I was
just soliciting feedback about its more general usefulness.

Thanks,
Doug



On Thu, 18 Nov 2004, Tony Plate wrote:

> If you want to avoid typing, why not just use a shell that offers file-name 
> completion?  Lots do.  That would seem to address the problem in the place 
> where it arises.
> 
> I don't think it would be a good idea to make R try to guess whether it 
> really should use the second argument after BATCH as an output file.  This 
> type of complication can have unintended and unanticipated side effects -- 
> "Do What I Mean" programming tools have not been a huge success because 
> it's impossible to always accurately guess what a person means.  I don't 
> know about other people, but I use scripts to generate scripts all the time 
> (for generating commands to run experiments with different sets of parameters).
> 
> -- Tony Plate
> 
> At Tuesday 03:32 PM 11/16/2004, Douglas Grove wrote:
> >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
> >
> >______________________________________________
> >R-devel at stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list