From tplate at acm.org  Thu Nov 18 18:58:07 2004
From: tplate at acm.org (Tony Plate)
Date: Thu Nov 18 18:58:22 2004
Subject: [Rd] modification of BATCH
In-Reply-To: <Pine.LNX.4.58.0411161409530.7962@echidna.fhcrc.org>
References: <Pine.LNX.4.58.0411161409530.7962@echidna.fhcrc.org>
Message-ID: <6.1.0.6.2.20041118104207.05f0c888@mailhost.blackmesacapital.com>

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@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] modification of BATCH
Tony Plate