Jonathan
Jonathan

Reputation: 5288

How can I have history completion / filtering when running R in Windows using the up/down arrows (like MATLAB)?

I'm used to using R in Linux, which is wonderful. However, I really need to be using Windows. I've been using Rgui.exe that comes with the R installation and the history completion feature is missing. By this, I mean that I can start to type a command and then press the up-arrow to browse through the history for commands that start with what is typed (similar to the way MATLAB handles the history).

The closest thing I've found is to use RStudio, which allows this functionality with "Ctrl+Up Arrow" (which is a livable solution). It would be nice to be able to do this with just the arrow keys and to do it in Rgui.exe or other minimal R interface. Any suggestions?

Upvotes: 2

Views: 668

Answers (2)

richiemorrisroe
richiemorrisroe

Reputation: 9513

Use RTerm.exe, as this includes tab completion (its very strange that RGUI on Windows doesn't, especially as the Mac GUI does).

Upvotes: 2

jbaums
jbaums

Reputation: 27398

If you run R from Cygwin, you can use reverse-i-search to cycle through commands that match the given pattern and which have been executed during the current R session.

Hit CTRL-r to initiate the reverse search, then as you type the pattern to be matched against the history, the most recently executed match will dynamically appear. Keep pressing CTRL-r to cycle through the matching items.

In the example depicted below, I've initiated a reverse search for 'LET'.

reverse-i-search example

Upvotes: 2

Related Questions