[R-SIG-Mac] Gui vs. command line - differentiating programmatically

Simon Urbanek simon.urbanek at r-project.org
Mon Apr 27 17:15:10 CEST 2009


On Apr 27, 2009, at 10:28 , hadley wickham wrote:

> Hi all,
>
> Is it possible to tell whether someone is using the R GUI or the
> command line programmatically?
>

Yes. If you're literally interested in the R.app GUI
Sys.getenv("R_GUI_APP_VERSION")
will be a real number (non-empty check should do).
If you want to know whether you're running in some GUI with Aqua  
support (the R GUI is one of them, but it could be others, too), you  
can use
.Platform$GUI=="AQUA"
This may, however, change in the future as we generalize AQUA-specific  
features into core R.

Cheers,
Simon



More information about the R-SIG-Mac mailing list