[Rd] [R] help with read.table() function
Duncan Murdoch
murdoch at stats.uwo.ca
Mon Jan 30 00:03:34 CET 2006
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
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.
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.
Duncan Murdoch
More information about the R-devel
mailing list