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

Gad Abraham gabraham at csse.unimelb.edu.au
Wed Jul 30 10:29:47 CEST 2008


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)


-- 
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: gabraham at csse.unimelb.edu.au
web: http://www.csse.unimelb.edu.au/~gabraham



More information about the R-help mailing list