Being the data and visualization nerd that I am, I’ve been delving into R on occasion.  For this purpose, I am using R.app on my Mac.  To start it up for a certain working directory (to keep different projects separate), I run “open -a R <working dir>".  This worked great until I noticed that my history wasn’t getting saved to the .Rhistory file in each directory.  When I use the command line R executable it does, but not in the R.app GUI.

So, it took me a little while to figure out that it’s a bug in the R.app code and you have to use a workaround.  Open R.app’s preferences and set the “R history file” key to something other than “.Rhistory”:

rhistory

Now, after a restart, the .nateRhistory file in the working directory is properly updated.