My RStudio Configuration

I help a few of dozen users install RStudio and learn R regularly. Whenever I need to install RStudio on a new machine, I have to think a bit about the configuration options I’ve tweaked. Invariably, I miss a checkbox that leaves me with slightly different RStudio behavior on each system. This post includes screenshots of my currently preferred standard RStudio configuration and custom keyboard shortcuts for RStudio 1.3, MacOS.

If you need an exact copy of your settings, consider the discussion at https://stackoverflow.com/questions/55903423/export-import-rstudio-user-preferences-global-setting-etc/55940249 (h/t: liebrr)

RStudio Tools, Global options, General, Basic tab

I prefer never to save the workspace and not to restore any workspace that might have been saved. That way, my environment is clean on each project launch and I can be confident that the results I’m observing aren’t an artifact of some previous session. That’s an invaluable assurance when you’re debugging.

RStudio Tools, Global options, General, Advanced tab

Showing .Last.value in the Environment pane is a valuable debugging tool. Since the name begins with a period, this variable is hidden by default. However, RStudio lets me make it visible and it’s often helpful to have a quick check on the structure of the last evaluated expression.

RStudio Tools, Global options, Code, Editing tab

I prefer to use 2 spaces for indentation rather than tabs. A space is a space is a space in any text editor, but tabs can behave differently given different users’ and different text editors’ configurations.

RStudio Tools, Global options, Code, Display tab
RStudio Tools, Global options, Code, Saving tab

Force yourself to adjust to an all UTF-8 encoded world and life— or at least coding— will be much simpler. Consider the experience of Yuhui Xie, creator of the knitr package.

RStudio Tools, Global options, Code, Completion tab

I prefer not to have code completion options popup on their own when I pause typing. I make too many accidental selections when they auto appear.

RStudio Tools, Global options, Code, Diagnostics tab

Show me all the diagnostic information! I can take it.

RStudio Tools, Global options, Appearance

I use the lovely FiraCode font which uses ligatures to enhance common programming sequences such as the assignment operator <- or inequality predicate !=

By placing the Source and Console side by side, I can maximize the vertical space available for each. The History and Connections panes are my least used panes, so I leave those unchecked. This creates what feels like a natural flow to me:

  • top left loads files and data
  • bottom left to edit scripts
  • top right to see immediate results
  • bottom right to see lasting changes to my environment, plots, help, etc.
RStudio Tools, Global options, Packages management tab

In an enterprise environment, if your organization uses a self-signed SSL certificate to inspect network traffic, you may need to disable the secure download option and direct RStudio to use the OS security library/proxy for HTTP instead.

RStudio Tools, Global options, Packages, Development tab
RStudio Tools, Global options, R Markdown tab
RStudio Tools, Global options, Sweave tab
RStudio Tools, Global options, Spelling tab
RStudio Tools, Global options, Git/SVN tab

Yes, you should use version control. Take the dive and learn about it.

RStudio Tools, Global options, Publishing tab
RStudio Tools, Global options, Terminal tab
RStudio Tools, Keyboard Shortcuts Customizations - Mac

On MacOS, my keyboard shortcuts concentrate common actions on the command key while on Windows, I use the ALT key (Alt+Up to clear the console; Shift+Alt+Up to restart the R session, Alt+Right to insert the magrittr pipe operator, etc.)