[R] find a previous command that starts with a certain letter

Loris Bennett loris.bennett at fu-berlin.de
Thu Feb 19 11:19:38 CET 2015


"CasasPrat,Merce [Ontario]" <Merce.CasasPrat at ec.gc.ca> writes:

> Hi,
>
> I'm new to R (was using Matlab previously)
>
> Matlab has a very convenient utility that I haven't been able to find
> in R. When working interactively, you can find a previous command that
> starts with a certain letter by typing such a letter and then pressing
> the cursor up key. In R I've seen that, despite the letter you type,
> when pressing the cursor up key, it goes to the immediately previous
> command.
>
> So, do you know if there is any way in R to quickly search for
> previous commands starting with a certain letter?
>
>  
>
> Thanks!!
>
> Merce

You should be able to do

Ctrl-r

(for "reverse search") and then type any part of the command you want.
You can then also do

Ctrl-s

(for "search") to search in the other direction (i.e. towards more
recently entered commands).

These are all functions of the "readline" library, which is also used in
many other programs (such as the "bash" shell).

Cheers,

Loris

-- 
This signature is currently under construction.



More information about the R-help mailing list