From ggrothendieck at gmail.com  Mon Jan 30 01:28:50 2006
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sun, 29 Jan 2006 19:28:50 -0500
Subject: [Rd] [R] help with read.table() function
In-Reply-To: <43DD49C6.201@stats.uwo.ca>
References: <20060129162850.73978.qmail@web33204.mail.mud.yahoo.com>
	<43DCF7E8.2080900@stats.uwo.ca>
	<971536df0601291024n57113e97t3cc938a78a11f495@mail.gmail.com>
	<43DD3D75.6010404@stats.uwo.ca>
	<971536df0601291420g5dd9732dl2108a5661705d7e2@mail.gmail.com>
	<43DD49C6.201@stats.uwo.ca>
Message-ID: <971536df0601291628u3baaa9f9pb50fadb444772a50@mail.gmail.com>

On 1/29/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 1/29/2006 5:20 PM, Gabor Grothendieck wrote:
> > On 1/29/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> >> On 1/29/2006 1:24 PM, Gabor Grothendieck wrote:
> >>  > Normally one expects stdin to be the default on command line
> >>  > programs and something like file.choose to be the default on GUI
> >>  > programs and this would break that expectation.
> >>
> >> We don't currently meet that expectation, so I don't think it would make
> >> things any worse.  As I mentioned to Brian, I wouldn't change the
> >
> > II don't think you understood my point.  This is how most software works,
> > IN GENERAL, so R should be expected to work that way
> > too.
>
> I think I understood that, but my point is that R doesn't act that way
> now, and this change won't make the situation worse.
>
>  >I don't think not having a default is so bad but having the wrong
> > default that breaks the stereotype that one expects in all software
> > is bad.
>
> I don't follow your argument.  Why is it better to say
>
> Error in read.table() : argument "file" is missing, with no default

Because that does not mix conventions.

>
> than it would be to ask the user which file to read?  The first is
> unexpected in both of the situations you described, while the second is
> only unexpected in a command line program.

Because its conventional that stdin is the default.  Even in R someone
must have realized that since that is the default for scan.


>
> Consistency is a good thing, but there are a number of choices of what
> to be consistent with:
>
>  - other similar functions in R (but they are inconsistent)
>  - previous versions of R (which is why I wouldn't change scan())
>  - other software a user would be familiar with (which is why
> file.choose() is a good idea in a GUI, but not in a command line program).
>
> > What could be done is to add something about file.choose to the
> > error message that one gets when one does read.table("myfile")
> > and it can't find "myfile".
>
> Currently our error messages explain what went wrong, they generally
> don't try to suggest alternative approaches (though a few do, e.g.
> help("dfdsfs")).  There are a lot of reasons read.table() could fail,
> and I think it would be very hard to get a good automatic rule on when
> file.choose() was the appropriate alternative.

I wasn't suggesting an automatic solution but I think it could be helpful
if the error message pointed out the existence of file.choose.



[Rd] [R] help with read.table() function
Gabor Grothendieck