[Rd] [R] choose folder interactively
Simon Urbanek
simon.urbanek at r-project.org
Wed Nov 28 15:50:07 CET 2012
On Nov 28, 2012, at 8:56 AM, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On 28/11/2012 13:43, R. Michael Weylandt wrote:
>> On Wed, Nov 28, 2012 at 12:47 PM, Duncan Murdoch
>> <murdoch.duncan at gmail.com> wrote:
>>> On 12-11-28 7:39 AM, Ivan Calandra wrote:
>>>>
>>>> Dear users,
>>>>
>>>> I am looking for a function to choose a folder interactively, just like
>>>> file.choose() but for a folder.
>>>>
>>> "choose.dir()" does exist on Windows, so you could switch to that OS, or
>>> write your own equivalent for MacOS.
>>
Unfortunately choose.dir() is one of those hacks that were added without any plan. Ideally, it should be deprecated and replaced by a proper solution (we have those bad platform-specific hack both in the Mac and Windows camps - equally bad). In this particular case it should not be hard, because the name is counter-intulitive, so adding an argument to file.choose() along the lines file-only/file-or-folder/folder-only (which I would ague for) or adding a dir.choose() function that can be relied upon is possible. The implementation is not the problem since we already have cross-platform implementation for file.choose(). While at it, we may also consider adding a flag for allowing multiple items selection...
Cheers,
Simon
>> Is this the sort of thing for which a patch to the Mac-specific code
>> would be welcomed/of some interest by R-Core or are their good reasons
>> this doesn't already exist?
>
> Yes, it would be of interest. It would need to rely on Aqua/Quartz and be written in Objective-C: unless something is done for the Quartz event loop in command-line R (which is not impossible as the quartz() device does so), it would be confined to R.app.
>
> The main constraint is that we have very few people who know enough about Mac GUI programming (and Objective-C) and R internals.
>
> It was simple enough on Windows as we already had choose.files (and a GUI for file.choose): that would also be worthwhile on a Mac. We also has someone keen enough on Windows GUI programming (although he did not last long).
>
>
>> Michael
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>
> --
> Brian D. Ripley, ripley at 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
>
>
More information about the R-devel
mailing list