No alternative seems to beat the RStudio IDE if your work heavily relies on R and its modern ecosystem (yet has still not been convinced hundred percent but close enough). ESS has just been great and unavoidable for over the years; however, for those who just want a decent editor, and not desire, or able to, fully adapt themselves to the Emacs world will not get a fruitful experience. Therefore one should always reconsider its alternatives to which suits best for its needs. ESS is handy when you need to connect to a remote server e.g. via SSH, and RStudio is the best on desktop version.

I compile a list of some keyboard shortcuts, packages, snippets and add-ins boosting my productivity that are usually present my in use everyday tasks.



The packages mentioned here just indicates how they can improve the working, not the actual work.


You can measure the performance of computing with microbenchmark which computes each argument 100 times to give results on average. Further, the benchmark can be visualized via autoplot() function dependent upon ggplot2 package. The alternative of this package in base R is system.time() function.



Profvis is a nice package/tool to understand how R spends its time. I will start trying to use to optimize my Shiny applications.



Lintr package gives you nice ‘linting’ which are gently reminders to have command over your own styling and syntax. Linting suggestions will not not improve performance or speed at all; however, the readability will boost up as the R language should be written for humans at first, and then computers. Therefore, run lintr::lint("file.R") and/or lintr::lint_package().



RStudio add-ins is just its extension mechanism to customize your working environment. Your productivity can significantly be increased together with lots of useful add-ins which you previously doing by hand spending hard time to fix the things to look it correct. I recently discovered the add-ins and they just great.

Most of the add-ins requires devtools package.


I here curate the addins I like. You can click here if you prefer to see a more comprehensive list of addins.


I have really found datapasta a huge time saver. You can see the GIF above which I recorded in my working environment. It formats, add quotes, and concatenate the lists and vectors. My favorite things it does: 1) Paste (as data.frame and vector) 2) Fiddle Selection 3) Toggle Vector Quotes. It’s dependent upon ‘readr’, ‘clipr’ packages, and uses RStudio’s API (possible to use without it). It’s on CRAN, so installation is easy as install.packages("datapasta").

However, I did not find useful yet to assign any keyboard shortcut to any of the provided functions.


A Shiny based GUI theme assistant for ggplot2 can significantly help your plotting work.



A RMarkdown addin which is useful e.g. when especially constructing tables.



I will list the shortcuts that I usually exercise. For a comprehensive list, you can always visit Tools > Keyboard Shortcuts Help.

The updated link:


Command Windows/Linux Mac Note
Keyboard shortcut reference Alt + Shift + K Option + Shift + K a shortcut to rule them all
New R file Ctrl + Shift + N Cmd + Shift + N  
Function help F1 F1 the most useful
Function source code F2 F2  
Search the history from console Ctrl + ↑ Cmd + ↑ powered by .Rhistory
Move cursor to editor Ctrl + 1 Ctrl + 1 moving without touching mouse
Move cursor to console Ctrl + 2 Ctrl + 2 (not touching mouse!)
Clear console Ctrl + L Cmd + L  
Open tab search Ctrl + Shift + . Ctrl + Shift + .  
Previous tab Ctrl + F11 Ctrl + F11  
Next tab Ctrl + F12 Ctrl + F12  
First tab Ctrl + Shift + F11 Ctrl + Shift + F11  
Last tab Ctrl + Shift + F12 Ctrl + Shift + F12  
Delete line Ctrl + D Cmd + D  
Autocompletion Tab Tab also Ctrl + Space
Assignment operator Alt + - Option + - ’<-‘
Pipe operator Ctrl + Shift + M Cmd + Shift + M ’%>%’ from magrittr
Add header Ctrl + Shift + R Cmd + Shift + R # Header - - - (…)
More little boxes Ctrl + Alt + H Cmd + Option + H customized add-in (see above)
Goto function/file Ctrl + . Cmd + . works in the project
Find in files Ctrl + Shift + F Cmd + Shift + F search in all files within scope
Comment/Un-comment line Ctrl + Shift + C Cmd + Shift + C when lines selected
Re-indent lines Ctrl + I Cmd + I  
Reformat code Ctrl + Shift + A Cmd + Shift + A readable code, sometimes odd
Focus to plot Ctrl + Shift + 6 Ctrl + Shift + 6 return to the main view with 0
Restart R session Ctrl + Shift + F10 Cmd + Shift + F10 ‘Session > Restart R’

RMarkdown (.Rmd files)

Command Windows/Linux Mac Note
Add a new chunk Ctrl + Alt + I Cmd + Option + I adds R chunk by default
Run all previous chunks Ctrl + Alt + P Cmd + Option + P  

Package Development

Command Windows/Linux Mac Note
Build and Reload Ctrl+Shift+B Cmd+Shift+B  
Load All (devtools) Ctrl+Shift+L Cmd+Shift+L  
Test Package (Desktop) Ctrl+Shift+T Cmd+Shift+T  
Test Package (Web) Ctrl+Alt+F7 Cmd+Alt+F7  
Check Package Ctrl+Shift+E Cmd+Shift+E  

Seeing the customized keyboard shortcuts from the add-ins which are stored in. If you are in any .nix based systems:

cd ~/.R/rstudio/keybindings
cat addins.json

If you modified any other shortcuts, also check editor_bindings.json and rstudio_bindings.json files.

Code Snippets

They are great especially when I am in a long debugging process, needed to type the similar things to the console to invoke the commands every time that usually an environment cleaning and restarting session is required. This article explains the basics and I shared my snippets here.

Custom themes

You can create one of the existing themes, or modify RStudio theme with CSS. This part is quite interesting cause it will give you much more control then you need in the console. The technique is originally adapted from this post, which has more detailed explanation. At the same time I update this post, I have R Studio version 1.1.447 (2018-04-18) and R version 3.4.3 (2017-11-30).

For a long time, I have been distracted from the line numbers placed on the right side of the main editor. I have always wish them to have more pale color that my eyes can differentiate it from the actual integer numbers in code file especially while I swiftly scroll up and down. Since RStudio uses JavaScript written Ace code editor, We see down that how modifying the theme is actually possible (without creating a new theme) by modularizing the code with your favorite browser’s console.

Before and after... Nice view!

Steps to do it:

  1. Choose an area you want to change
  2. Do a right click and select ‘Inspect Element
  3. The console layout like a browser will be opened up
  4. Scroll down a bit, find and click on the <link> tag referencing a CSS file
  5. Play with the CSS selectors in real time
  6. After you are happy with changes, go to the actual path and overwrite the document
    • (do not forget to take a backup of the original file)
  7. Then your changes are permanent

NOTE: I will keep this post updated as long as new shortcuts, tools and add-ins come along.