Customizing RStudio

Overview

RStudio options are accessible from the Options dialog Tools : Options menu and include the following categories:

  • General R Options — Default CRAN mirror, initial working directory, workspace and history behavior.
  • Source Code Editing — Enable/disable line numbers, selected word and line highlighting, soft-wrapping for R files, paren matching, right margin display, and console syntax highlighting; configure tab spacing; set default text encoding.
  • Apperance and Themes — Specify font size and visual theme for the console and source editor.
  • Pane Layout — Locations of console, source editor, and tab panes; set which tabs are included in each pane.
  • Version Control — Configure locations of Git and Svn binaries and create and/or view SSH RSA keys.

Details on the various settings are provided in the sections below.

General R Options

Alt text

  • Default working directory — Startup directory for RStudio (when not in a project). The initial .RData and .Rprofile files (if any) will be read from this directory. The current working directory and Files pane will also be set to this directory. Note that this setting can be overridden when launching RStudio using a file association or a terminal with a command line parameter indicating the initial working directory.
  • Save workspace to .RData on exit — Ask whether to save .RData on exit, always save it, or never save it. Note that if the workspace is not dirty (no changes made) at the end of a session then no prompt to save occurs even if Ask is specified.
  • Restore .RData into workspace at startup — Load the .RData file (if any) found in the initial working directory into the R workspace (global environment) at startup. If you have a very large .RData file then unchecking this option will improve startup time considerably.
  • Always save history (even when not saving .RData) — Make sure that the .Rhistory file is always saved with the commands from your session even if you choose not to save the .RData file when exiting.
  • Remove duplicate entries in history — Prevent addition of commands to history if they are the exact same as the most recently added command.
  • CRAN mirror — Set the CRAN mirror used for installing packages (can be overridden using the repos argument to install.packages).
  • Restore most recently opened project at startup — When opening RStudio automatically re-open the most recently used project.

Source Code Editing

Alt text

  • Highlight selected word — Add a background highlight effect to all instances of the currently selected word within the document.
  • Highlight selected line — Add a background highlight effect to the currently selected line of code.
  • Show line numbers — Show or hide line numbers within the left margin.
  • Insert spaces for tab — Determine whether the tab key inserts multiple spaces rather than a tab character (soft tabs). Configure the number of spaces per soft-tab.
  • Show margin — Display a margin guide on the right-hand side of the source editor at the specified column.
  • Automatically insert matching parens/quotes — When typing a paren, quote, or brace automatically insert a matching one and position the cursor between them.
  • Soft-wrap R source files — Wrap lines of R source code which exceed the width of the editor onto the next line. Note that this does not insert a line-break at the point of wrapping, it simply displays the code on multiple lines in the editor.
  • Show syntax highlighting in console input — Apply R syntax highlighting to the console input line.
  • Default text encoding — Specify the default text encoding for source files. Note that source files which don't match the default encoding can still be opened correctly using the File : Reopen with Encoding menu command.

Appearance and Themes

Alt text

  • Font size — Set the font size (in points) for panes which display code (Console, Source, History, and Workspace).
  • Editor theme — Specify the visual theme for the Console and Source panes. You can preview the theme using the inline preview or by pressing the Apply button.

Pane Layout

Alt text

  • Specify the location and tab sets of panes within RStudio.
  • Each of the 4 panes is always displayed (it isn't currently possible to hide a pane).

Version Control

Alt text

  • Git executable — Location of Git executable. By default RStudio locates the Git executable in the system path. If you want to use a version of Git not on the path you can specify it here.
  • SVN executable — Location of SVN executable. By default RStudio locates the SVN executable in the system path. If you want to use a version of Git not on the path you can specify it here.
  • SSH RSA Key — When using SSH with RSA public/private key authentication against a remote Git or Subversion repository you need to generate an RSA key and then provide the public key to the remote server. You can both create a new RSA key and view/copy its public key within the Version Control options panel.