[R] R command to open a file "browser" on Windows and Mac?

Duncan Murdoch murdoch.duncan at gmail.com
Mon Aug 3 17:27:25 CEST 2015


On 03/08/2015 11:19 AM, Jonathan Greenberg wrote:
> Folks:
> 
> Is there an easy function to open a finder window (on mac) or windows
> explorer window (on windows) given an input folder?  A lot of times I want
> to be able to see via a file browser my working directory.  Is there a good
> R hack to do this?

On Windows, shell.exec(dir) will open Explorer at that directory.
(It'll do something else if dir isn't a directory name, or has spaces in
it without quotes, so you need to be a little careful.)

On OSX, system2("open", dir) should do the same.

Duncan Murdoch



More information about the R-help mailing list