Command History in the RStudio IDE


Using Command History

The RStudio IDE maintains a database of all commands which you have ever entered into the Console. You can browse and search this database using the History pane.

Browsing History

Commands you have previously entered in the RStudio console can be browsed from the History tab. The commands are displayed in order (most recent at the bottom) and grouped by block of time:

Searching History

Executing a Search

You can use the search box at the top right of the history tab to search for all instances of a previous command (e.g. plot). The search can be further refined by adding additional words separated by spaces (e.g. the name of particular dataset):

Showing Command Context

After searching for a command within your history you may wish to view the other commands that were executed in proximity to it. By clicking the arrow in the right margin of the search results you can view the command within its context:

Using Commands

Commands selected within the History pane can be used in two fashions (corresponding to the two buttons on the left side of the History toolbar):

  • Send to Console— Sends the selected command(s) to the Console. Note that the commands are inserted into the Console however they are not executed until you press Enter.
  • Insert into Source— Inserts the selected command(s) into the currently active Source document. If there isn't currently a Source document available then a new untitled one will be created.

Within the history list you can select a single command or multiple commands:


Related Topics