[Rd] file.choose (PR#2465)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Fri Jan 17 14:41:03 2003

On Fri, 17 Jan 2003, Duncan Murdoch wrote:

> On Thu, 16 Jan 2003 14:52:24 +0100 (MET), you wrote:
> >R1.6.2 winnt.
> >
> >file.choose() gives an error if the dialog is cancelled without choosing a
> >file. This can be easily dealt with via try(), but I would have thought that
> >a NULL or NA return would be the expected behavior.
> I'd be worried that a change like that would lead to bugs downstream.
> Routines that make use of file.choose results would now have to check
> for invalid input.

I agre..

> On the other hand, file.choose() could be more flexible.  For example,
> the other day someone suggested to me that "install library from local
> zip file" should be able to install multiple packages at once, and
> that makes sense, but it requires multiple selections to be enabled in
> the file selection menu.  There are a lot of other options to standard
> Windows file dialogs, but I can't spot any that would really be
> appropriate here.  Can anyone else?

Unfortunately file.choose() is a cross-platform function documented to 
return just one file name.  It's a legacy of the MacOS beginnings, and no 
one has ever told me what the `new' argument was intended to do.

I think we might to start again with choose.files(), with an argument that 
allowed multiple choices, and hope it can really be implemented on all the 
GUI-based interfaces (on Unix file.choose is not even based on choosing 
from a text list).

Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595