[R-SIG-Mac] R.app intractable history problem

Gaël Laurans glaurans at gmail.com
Fri Nov 6 18:26:22 CET 2009


On Nov 6, 2009, at 5:36 PM, Rob Goedman wrote:

> Vi,
>
> My machine developed a problem yesterday evening, so I can only do  
> email right now.
>
> Can you try below step after renaming the .Rhistory file to  
> something like .myRhistory?
>
> As a 2nd question, if you type .Last in RConsole, what does it show?
>
> Thanks,
> Rob
>
> On Nov 6, 2009, at 8:25 AM, Vishy Iyer wrote:
>
>> Final twist in this saga for me... I found that if I quit R.app using
>> the menu command or Cmd+Q AND click on "Save" workspace, it saves the
>> workspace, and a new .Rhistory file is written, but that .Rhistory
>> file is empty! Clearly R is overwriting .Rhistory when I save the
>> workspace, even though I'm using Cmd+Q.
>>
>> But if I Cmd+Q and click "Don't save" workspace, the .Rhistory file  
>> is
>> saved properly and contains all history.
>>
>> All of the above is when I've changed the working directory by drag &
>> dropping on R.app icon (R version 2.10 on Mac OSX 10.5.8)


As I tried to explain in my last message, this is exactly the behavior  
I am observing (R.app 1.30-devel, build 5508, R 2.10.0 RC, Mac OS  
10.5.8):
- an empty .Rhistory file is created (potentially overwriting any  
other file by that name) if R.app is setup to automatically save the  
workspace when quitting, when entering quit(save="yes") at the prompt  
or choosing "save" in the popup window, etc.
- R.app's history is saved only when quitting R.app through the GUI,  
not when typing quit() There are two ways to protect this file:  
renaming it and never ever saving your workspace when quitting (i.e.  
save it before, with save.image(), possibly in .Last and choose "no"  
in the "Save workspace on exit from R" box in the preferences)

Incidentally, I noticed that R.app's preferences are also discarded  
when quitting through R's quit() function, which makes sense given  
Simon's explanations but might add some confusion when trying to  
follow the usual advice to change the name of the history file while  
still using quit().

I only understood all this last week when reinstalling R.app but I  
don't recall reading about it in the many threads about history in the  
mailing list archive. Maybe Simon's advice to avoid quit() should be  
added to the FAQ somewhere.

Best,
Gaël


More information about the R-SIG-Mac mailing list