[R] R console history v/s unix history

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Sep 18 10:45:17 CEST 2001

Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> On Mon, 17 Sep 2001, steven cha wrote:
> > Hi
> >
> > i'm new to R and find that the "history" functionality works a little
> > different than in unix. A very convenient feature of history in unix
> > is the ability to recall a comand by typing in !x where x is a letter
> > and the latest matching command in the history that starts with the letter
> > is (re)called. This is useful for instance, when calling a "source" command
> > by !s rather than having to scroll back using the arrow key. Does this
> > functionality exist in R and if not any suggestions on how to replicate
> > it?
> Which version of R are you talking about?  Unix versions of R have
> bash-like behaviour, but I think you are describing a feature of the
> C-shell (and with history turned on, which is not the default), not of all
> Unix shells.

It's in bash too (but historically it comes from the C-shell). You
might add that S-PLUS (and several unix applications) use ! for the
shell escape. I.e. !ls shows the files in the current dir. R (for
UNIX/Linux) had that for a while (and I suspect you can still switch
it on somewhere in the sources), but we decided to do without it to
avoid confusion with the negation operator.

(You can imagine the befuddlement of a teacher explaining about
logical arithmetic in a hands-on session: "Here is a logical vector x,
and another one y. You can combine the vectors with AND like this: x &
y, or with OR like this: x | y. To negate a vector, use ! (NOT), !x

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list