[R] R command history -- can it be like Matlab's?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Aug 2 11:24:10 CEST 2008


Gad Abraham wrote:
> Prof Brian Ripley wrote:
>> A patch to do this was posted on 2007-09-29 by Glenn Davis.  Some 
>> people not addicted to Matlab find the behaviour very inconvenient 
>> and prefer the getline/readline behaviour (triggered by ^R/^S) of 
>> Rterm and R on Unixen.
>
> Now that you've mentioned readline, it doesn't behave exactly the same 
> in Bash and R: if you press ctrl-r and then ctrl-c in Bash, it breaks 
> the search and you go back to the prompt as normal. In R on Linux (all 
> versions I've tried, 2.2 to 2.7.1), doing that returns you to the 
> prompt but you can't type anything, and the input buffer retains the 
> text from the search, so pressing enter makes the historical command 
> run again.
>
> Try this:
> > ls()
> character(0)
> [ctrl-r]
> (reverse-i-search)`l': ls()
> [ctrl-c, then enter]
> > ls()
> character(0)
>
>
Not quite true that you can't type anything. What happens (for me) is 
that you are still in reverse-i-search, so you can get this effect from 
"^R l ^C d".

 >
(reverse-i-search)`l': ls()
(reverse-i-search)`l': ls()
 >
(reverse-i-search)`l': ls()
(reverse-i-search)`ld': levels(ftpain3) <- 
list(none="none",intermediate=c("mild","medium"),severe="severe")

It snaps out of it if you press ^C twice.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list