[R-SIG-Mac] Fwd: Re: [R] choose folder interactively

Ivan Calandra ivan.calandra at u-bourgogne.fr
Thu Nov 29 11:26:12 CET 2012


Thanks Philippe for your answer!
It doesn't work for me, but I guess I have something wrong with Tcl/Tk.

Ivan

--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra



-------- Message original --------
Sujet: 	Re: [R] choose folder interactively
Date : 	Thu, 29 Nov 2012 09:49:44 +0100
De : 	Philippe Grosjean <Philippe.Grosjean at umons.ac.be>
Répondre à : 	<Philippe.Grosjean at umons.ac.be>
Organisation : 	UMONS - EcoNum
Pour : 	<ivan.calandra at u-bourgogne.fr>



Dear Ivan,

I cannot post to R-help currently. This is something interesting for
you. Could you echo to R-Help and R-SIG-Mac too, please?

You will find a native Mac OS X directory selection dialog box in
svDialogs. Install the package (you also need to install svGUI) and see
?dlgDir.

It works both in R.app and in R run in the terminal. There is just a
little time lag when you call of of svDialogs's dialog boxes the first time.

It works the same on Windows and even on Linux/Unix, providing you have
installed zenity there (search Goggle, installed bty default on Ubuntu,
for instance).
In case the required GUI elements are not found on a particular system,
the function falls back automatically on a textual version at the
terminal. So, it should work everytime!

Don't forget to extract the result from the 'res' element... Something like:

mydir <- dlgDir()$res

Best,

Philippe Grosjean

..............................................<¡}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons University, Belgium
( ( ( ( (
..............................................................

On 28/11/12 13:39, Ivan Calandra wrote:
> Dear users,
>
> I am looking for a function to choose a folder interactively, just like
> file.choose() but for a folder.
>
> I have found tcltk::tk_choose.dir() but R hangs when I try to do
> anything and I have to force exit.
> I've tried to reinstall tcltk with install.packages(), but "package
> ‘tcltk’ is not available (for R version 2.15.2)" even though it's
> already installed on my computer (it comes with 'base', doesn't it?).
>
>  From a Google Search, I have also found choose.dir(), but it looks like
> this function doesn't exist anymore since ages.
>
> Any idea?
>
> Thanks in advance,
> Ivan
>
> sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
> locale:
> [1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
>



More information about the R-SIG-Mac mailing list