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

Rob Goedman robjgoedman at me.com
Wed Nov 4 17:01:05 CET 2009


David & Vi,

On Nov 4, 2009, at 7:20 AM, David Winsemius wrote:

> Even if you do not want to update to 10.0, there can be no reason  
> not to update to 2.9.2. I cannot promise that will fix your problems  
> but it certainly top on the list of  maneuvers to try.

Further on Vi's question and David's response, I looked back in my r- 
sig-mac email archive to refresh my memory. See below attached email  
exchange with Wil from a while ago. Time is flying ... I think Vi is  
hitting the same problem.

Upgrading is never bad though...

> -- 
> David
> On Nov 3, 2009, at 9:20 PM, vi wrote:
>
>> I have seen this asked before and read the threads but cannot find a
>> clear answer to this problem.
>>
>> I cannot manage to get the history to work from R.app. I am running R
>> version 2.9.0 on an iMac OSX 10.5.8 (Leopard). I've tried
>>
>> 1. Using default paths and names for startup (~) and history file
>> (.Rhistory). Run R.app by clicking on the dock, run a few commands.  
>> If
>> I save workspace, it writes ~/.Rhistory but that file is always  
>> blank.
>> Next session of R.app there is no history available of course. (If I
>> don't save workspace on exit, it does not write a ~/.Rhistory file at
>> all. Is this normal?)
>>

It's not normal, below exchange with time stamps did exhibit similar  
behavior.

snipped  a bunch ...

>> 4. d&d folder onto R.app icon, .Rhistory is written to that folder as
>> expected, but it remains empty no matter what.
>
> That is unclear. What folder?

The d&d folder if no 'fixed' working dir path is set in the Startup  
preferences. That's how it is supposed to work.

Regards,
Rob

----------------------------------------------------------------------------------------------------------------------------------------------------

On Feb 9, 2007, at 9:19 PM, Rob J Goedman wrote:

> Hi Wil,
>
> On Feb 9, 2007, at 8:52 PM, William Doane wrote:
>
>> On Feb 9, 2007, at 19:35, Rob J Goedman wrote:
>>> All of your tests seem to be using .Rhistory, have you tried  
>>> myHistory (no dot, maybe in different dir)?
>>> Just to make sure R does not override it at the end.
>>
>> A good suggestion... and fruitful.
>>
>> I used R.app's prefs panel to set the history file to  
>> "myhistory" (in the same default directory), and the history gets  
>> saved and stored correctly in the new file. (Which rather solves MY  
>> problem, but the bug still remains.)
>>
>> On a lark, I launched R.app, PICOed .Rhistory and added a valid  
>> line of R code, and saved it. At this point, R.app is STILL using  
>> the "myhistory" file as the history file.
>>
>> When I quit R.app and confirmed the quit, "myhistory" was correctly  
>> updated, but .Rhistory was reverted to zero bytes!
>>
>> Seems like something else is writing to .Rhistory explicitly during  
>> the final clean up process.
>
> Yes, I'm pretty sure it is R itself. Although you have  
> removed .Last, somehow R still thinks is has to save
> the history, which will be empty as we're not updating it from  
> within R.app. Hence 0 length.
>
>>> The confirmation after quit is only about saving your image.  
>>> Quitting, at that point, is a done deal I though.
>>> But R.app does terminate R later on.
>>
>> R.app (and R terminal, for that matter) still has the option to  
>> cancel the quit at this point... the options are Don't save, Save,  
>> or Cancel -- the last of which puts you back in R.app, but having  
>> written out the history file.
>
> Yip, you're right, I've clearly been running R.app too long with an  
> automatic 'No' answer set.
>
>> Interestingly, selecting quit, then cancel leaves the correctly  
>> written .Rhistory file in place. Selecting quit again, then save or  
>> don't save overwrites the file to zero bytes.
>
> Points at R itself.
>
>> So, combined with the above, it seems like whatever is writing  
>> to .Rhistory and zeroing it out is happening AFTER the "Save"  
>> button (or "Don't Save" button) is clicked and is ignoring the  
>> R.app preference setting for the history file's name.
>
> Yip, R itself :-)
>
>> This doesn't happen from R run thru Terminal, so I'm still assuming  
>> this is an R.app specific issue.
>
> I'll check the sources a bit more. My guess is something is left  
> over from the .Last setting.
>
> But you should be ok for now. Thanks for digging a bit deeper.
>
> Regards,
> Rob



On Feb 9, 2007, at 8:52 PM, William Doane wrote:

> ... (snipped, as above)

> The timestamp gets updated twice... when quit is selected, and again  
> when quit is confirmed, as shown in this Terminal session:
>
> $ rm .Rhistory
> $ touch .Rhistory
> $ # launch R.app
> $ ls -la .R*
> -rw-r--r--   1 wejdoane  wejdoane  1180 Feb  9 23:29 .RData
> -rw-r--r--   1 wejdoane  wejdoane     0 Feb  9 23:29 .Rhistory
> -rw-r--r--   1 wejdoane  wejdoane   357 Feb  9 14:46 .Rprofile
> $ # wait a minute...
> $ # select quit, but don't confirm
> $ ls -la .R*
> -rw-r--r--   1 wejdoane  wejdoane  1180 Feb  9 23:29 .RData
> -rw-r--r--   1 wejdoane  wejdoane     5 Feb  9 23:31 .Rhistory
> -rw-r--r--   1 wejdoane  wejdoane   357 Feb  9 14:46 .Rprofile
> $ # wait another minute before confirming...
> $ # confirm
> $ ls -la .R*
> -rw-r--r--   1 wejdoane  wejdoane  1180 Feb  9 23:32 .RData
> -rw-r--r--   1 wejdoane  wejdoane     0 Feb  9 23:32 .Rhistory
> -rw-r--r--   1 wejdoane  wejdoane   357 Feb  9 14:46 .Rprofile
> $



More information about the R-SIG-Mac mailing list