[R-SIG-Mac] Determine GUI status

Byron Ellis byron.ellis at gmail.com
Sat May 5 08:05:05 CEST 2007

Yes. When you're running R as an Emacs slave process (via ESS for
example), Emacs will set an environment variable EMACS=t that you can
test with Sys.getenv(). To detect a Terminal versus R.app, the
Terminal application will generally set the TERM and TERM_PROGRAM
environment variables, which are generally not set under R.app. This
breaks down if the user starts the R GUI from the command line, but
there (at least under Tiger+) you'll find that an environment variable
"_" has been set that is not present in either the normal Terminal
startup or the normal R.app startup.

On 5/4/07, Steven McKinney <smckinney at bccrc.ca> wrote:
> Is there a way to programatically
> check whether the R session is
> running with R.app (versus, say
> running in Emacs ESS mode in an
> Emacs buffer)?
> I'd like to programatically decide on
> appropriate plot devices etc.
> I've checked Sys.info() and related functions
> but I'm not noticing R.app info in
> any returned fields.  Either I missed
> something or I haven't found the right
> function call yet.
> Any info appreciated.
> Best
> Steven McKinney
> Statistician
> Molecular Oncology and Breast Cancer Program
> British Columbia Cancer Research Centre
> email: smckinney at bccrc.ca
> tel: 604-675-8000 x7561
> Molecular Oncology
> 675 West 10th Ave, Floor 4
> Vancouver B.C.
> V5Z 1L3
> Canada
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Byron Ellis (byron.ellis at gmail.com)
"Oook" -- The Librarian

More information about the R-SIG-Mac mailing list