Re: [Rd] [R] help with read.table() function

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon 30 Jan 2006 - 00:28:50 GMT

On 1/29/06, Duncan Murdoch <murdoch@stats.uwo.ca> wrote:
> On 1/29/2006 5:20 PM, Gabor Grothendieck wrote:
> > On 1/29/06, Duncan Murdoch <murdoch@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.



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Jan 30 11:37:23 2006

This archive was generated by hypermail 2.1.8 : Mon 30 Jan 2006 - 10:36:01 GMT