[R] Rprofile: distinguish between Rgui, Rterm, JGR?

Michael Friendly friendly at yorku.ca
Thu May 27 23:05:47 CEST 2010


Duncan Murdoch wrote:
> Michael Friendly wrote:
>> [Environment: Win XP, R 2.10.1]
>>
>> In my Rprofile I have startup code to do various things, intended for 
>> when I use the Rgui console.
>> Some of these are causing problems in JGR now that I've installed 
>> it.  How can I test for R
>> running with Rgui to do some of these things only there?
>>
>>   
> Look at .Platform$GUI.  It shows "Rgui" or "RTerm" for those two.  I 
> don't have JGR installed, but I'd guess it shows something differently 
> there.
>
> Duncan Murdoch
Thanks, Duncan

This is helpful.  For anyone else's reference, both JGR  and 
eclipse/StatET (Win XP)  deliver the following

 > .Platform$GUI
[1] "unknown"

What prompted this was that I have code in Rprofile to save/restore my 
session history. But JGR replies
Error in loadhistory(file) :
  'loadhistory' can only be used in Rgui and Rterm

Then it hung on exit with savehistory(), forcing a crtl-alt-del 
excursion to the task manager.

-- 
Michael Friendly     Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list