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

Gaël Laurans glaurans at gmail.com
Thu Nov 5 09:49:14 CET 2009


On Nov 4, 2009, at 8:03 PM, vi wrote:

> Thanks for all the responses! Just some answers to the questions:
>
> - I don't have anything in my .Rprofile, .First and .Last. In fact I
> don't have these files on my computer, they were not created by me or
> by R.

.Last and .First are functions (potentially stored in a workspace, not  
necessarily defined in .Rprofile or anything). Simply type ".Last" or  
".First" at the R prompt to know if they are defined.

> - "that folder" in my d&d comment refers to the folder I drag and drop
> onto the R icon in dock. In this case, .Rhistory is created on exit in
> the folder I dropped. As Rob mentioned, this is the correct behavior
> when the "Always apply" is unchecked in prefs. But for me
> the .Rhistory file always remains blank even though it's created in
> the correct location.
> […]
> - Most bizzare for me is that no matter what file name I enter for the
> history file in prefs, with or without dot (ie, ~/myhistory
> OR .myhistory OR myhistory OR myname OR ~/xxx/yyy/myname OR /Users/me/
> xxx/yyy/myfile.txt or whatever), it ALWAYS goes back to .Rhistory
> after I quit, and the file is ALWAYS empty. But it IS created in the
> location I specify, in addition to a copy of .Rhistory in my home
> directory.
> […]
> My behavior also seems to be different from William Doane (thanks Rob,
> I'd missed that exchange in my searching). It's one of these things
> where I initially thought I was missing something obvious so I haven't
> tried upgrading yet, but I agree I should upgrade (will probably do a
> fresh install of 2.10) and hope it works.

The way you quit R seems to make a difference. If you use the menu or  
the Cmd+Q shortcut, R.app will save its history in the file defined in  
the preferences, but if you type quit() at the R prompt, R.app will  
not save its history at all. R itself will save its (empty) history  
and overwrite the .Rhistory file whenever you save your workspace upon  
quitting (i.e. if you say "yes" after quitting through the menu or use  
quit(save="yes") or set "save workspace on exit" to Yes in R.app's  
preferences), which might explain why you find empty .Rhistory files  
all over the place.

Regarding the preferences, I think someone mentioned it already but  
did you press "enter" immediately after entering the filename (without  
clicking anywhere)? If nothing helps, you can also edit ~/Preferences/ 
org.R-project.R.plist but that shouldn't be necessary.

Gaël


More information about the R-SIG-Mac mailing list