[R] Rconsole wishlist

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Mar 4 07:35:04 CET 2005


The problem is that the commands history is GUI-specific (there are four 
mechanisms, readline on Unix, one for the GUI MacOS X (I believe), one for 
RGui and one for rterm. And we will have to cope with both GNU and BSD 
readline shortly).  We try to keep them consistent, and that means a 
lowest-common denominator approach.

History is *not* intended to be a `command log' but a way to retrieve
recentish commands, and the console buffer is just that, a buffer.  They 
are implemented for fast access backwards and so not really appropriate 
for large logs.  If you want a session log, look at 'split' option to 
sink().

With the advent of multibyte characters (supported in R as from 2.1.0) we 
need to redesign some of this (rterm's command line will not support such 
locales for 2.1.0).  It should be possible to make the default R_HISTSIZE 
unlimited.

The console buffer is less clear: how do you want to be warned?  This 
could happen in the middle of a single print() command: it could even 
happen that a single line of output exceeds the buffer size.

Finally: R-devel is for R development issues, so if people want to pursue 
this, please move there.  (I am trying to be non-technical in this reply, 
and probably not succeeding.)


On Fri, 4 Mar 2005, Kjetil Brinchmann Halvorsen wrote:

> Duncan Mackay wrote:
>
>> Sorry, yes, Rgui under WinXP (SP2). But while Windows date stamps the
>> history file
>> 
>> 
>>> file.info(".Rhistory")
>>> 
>>          size isdir mode               mtime               ctime
>> .Rhistory 5377 FALSE  666 2005-03-04 10:37:52 2005-03-04 10:37:52
>>                        atime
>> .Rhistory 2005-03-04 13:54:11
>> 
>> the problem is that there can be multiple sessions stored in .Rhistory and
>> the session dates aren't stored there. Moreover, it seems to me that the
>> history buffer can also overflow without warning after long sessions or 
>> many
>> repeated sessions and so that you can inadvertently lose parts of your
>> command log.
>> 
> Yes. But you can define an environment variable R_HISTSIZE (or some similar 
> name, do a
> R site search to find. Not defined on my machine now. That should really be 
> in the help file for
> savehistory()) to avoid the problem.
>
>
>> (Is this right, anyone?) Perhaps it would be preferable for R
>> to save each session's command history in a separate history file, along 
>> the
>> lines of 
> NO. it is better to have just one file as now.
>
> Kjetil
>
>
>> .Last <- function() {
>> savefilename <- paste("Rhistory",date())
>> savefilename <- gsub(" ","_",savefilename)
>> savefilename <- gsub(":",".",savefilename)
>> savefilename <- paste(savefilename,".txt",sep="")
>> if(interactive())  try(savehistory(savefilename))
>> cat("Current history saved in file: ",savefilename,"\n")
>> }
>> 
>> but this doesn't address any overflow issues.
>> 
>> Duncan
>> 
>> 
>> -----Original Message-----
>> From: Liaw, Andy [mailto:andy_liaw at merck.com] Sent: Friday, 4 March 2005 
>> 11:14 AM
>> To: 'Duncan Mackay'; R-news
>> Subject: RE: [R] Rconsole wishlist
>> 
>> 
>> I'm guessing you're talking about Rgui on Windows, but please don't leave 
>> us
>> guessing.
>> 
>> If you run R under Ess/(X)Emacs, you have the entire session that can be
>> saved in a (transcript) file.
>> 
>> Does your OS not put date stamps on file?
>> 
>> 
>>> file.info(".Rhistory")
>>> 
>>          size isdir mode               mtime               ctime
>> .Rhistory 1025 FALSE  666 2005-03-03 19:27:31 2004-08-13 10:45:09
>>                        atime
>> .Rhistory 2005-03-03 19:27:31
>> 
>> Andy
>> 
>> 
>> 
>>> From: Duncan Mackay
>>> 
>>> Hi all,
>>> Wouldn't it be nice (??!!) if R automatically issued a
>>> warning message when
>>> the R console buffer was about to fill so that you could save all your
>>> output into a text file? (I know about sink(), but I think it would be 
>>> good
>>> to have an easier mechanism to save a complete record of messages and
>>> function output). And on a similar vein, wouldn't it also be nice if R
>>> automatically entered a date stamp into the history file??
>>> 
>>> Duncan
>>> 
>>> 
>>> *****************************************
>>> Dr. Duncan Mackay
>>> School of Biological Sciences
>>> Flinders University
>>> GPO Box 2100
>>> Adelaide
>>> S.A.    5001
>>> AUSTRALIA
>>> 
>>> Ph (08) 8201 2627    FAX (08) 8201 3015
>>> 
>>> 
>> http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html
>> 
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>> 
>> 
>> 
>> 
>> 
>> ----------------------------------------------------------------------------
>> --
>> Notice:  This e-mail message, together with any attachments,...{{dropped}}
>> 
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>> 
>> 
>> 
>> 
>
>
> -- 
>
> Kjetil Halvorsen.
>
> Peace is the most effective weapon of mass construction.
>              --  Mahdi Elmandjra
>
>
>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list