[R-SIG-Mac] getting history() to work

Simon Urbanek simon.urbanek at r-project.org
Mon Apr 12 16:41:23 CEST 2010


On Apr 12, 2010, at 4:36 , David Winsemius wrote:

>
> On Apr 8, 2010, at 11:45 AM, David wrote:
>
>>
>>
>> On 8 Apr, 13:32, David Winsemius <dwinsem... at comcast.net> wrote:
>>> On Apr 8, 2010, at 4:56 AM, David wrote:
>>>
>>>> When I type history() to the R console, I get a new window that is
>>>> always blank. How can I get history() working?
>>
>> ...[snip]...
>>
>>> It's been a whiles since I used R 2.8 but perhaps the current  
>>> behavior
>>> is similar. What happens when you:
>>>
>>> A) Open the Preferences dialog in the RGUI and look at your history
>>> settings (which in the current GUI are in the Startup panel.)
>> Looks normal to me. Setting relating to history seem OK. Should I  
>> send
>> you personally a screen shot? I don't think I can attach an image for
>> the whole forum. In Preferences, the history file was listed as
>> .Rhistory. I tried to change this to ~/.Rhistory, but when I closed R
>> and reopened it, it reverted to .Rhistory.
>
> (I use the GUI, so this may or may not parallel your experience.)  
> When I execute history() from the GUI console, a file opens up with  
> about 20 commands that I have not used recently. When I choose "Save  
> as" it offers the name "hist496ef7b9" and the location is a temp  
> directory fairly deep in the /private/var/... directories. It looks  
> like I was wrong about thinking that such files would always be  
> given an .Rhistory name. I get the recent historical entries in the  
> GUI by clicking the Show/Hide History icon. I suspect that the  
> history() function is more useful in the command line initiated  
> sessions of R but not normally used in the GUI sessions.
>

In the GUI the current history is accessed on the console (arrow keys)  
or via the history panel (Show/Hide History in the toolbar). That is  
the only supported way to interact with the current history.

The history() command only shows the last saved history as a file -  
i.e. essentially the history file in the preferences. The history is  
not saved until you close the console window or use the R -> Quit menu  
item. ( A side note: R.app does NOT support the q() or quit()  
functions since they save neither history nor open files).

Cheers,
Simon



>>
>>> B) Open a Terminal.app window and type in:
>>>  locate .Rhistory
>> I got a large number of hits. I recognized all the directories as
>> directories which had been, at one time or another, possibly with a
>> different version of R, the working directory for some R program. I
>> deleted all these hits as confusing the issue. I found one .Rhistory
>> in the working directory, containing a single command that I almost
>> certainly gave some time today. At some point today I deleted this
>> file and it has been re-created with this single command in it.
>> Nevertheless, history() continues to give me a blank screen. If  
>> things
>> were operating as I wish, there would have been many commands
>> in .Rhistory, since I have typed many commands to the R console  
>> today.
>> ...[snip]...
>>
>> David
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list