ActionWindows / LinuxMac
Run code
Execute current line or selectionCtrl + Enter⌘ + Enter
Execute entire scriptCtrl + Shift + Enter⌘ + Shift + Enter
Source file (without echo)Ctrl + Alt + R⌘ + Option + R
Session management
Clear consoleCtrl + L⌘ + L
Restart R sessionCtrl + Shift + F10⌘ + Shift + F10
Editing
Comment/uncomment linesCtrl + Shift + C⌘ + Shift + C
Reindent code (smart-indent)Ctrl + I⌘ + I
Insert the %>% pipeCtrl + Shift + M⌘ + Shift + M
Autocomplete / show suggestionsTabTab
Navigation
Focus Source / Console panesCtrl + 1 / Ctrl + 2⌘ + 1 / ⌘ + 2
Jump to function definition (Go to file)F2F2
Show command historyCtrl + Up Arrow⌘ + Up Arrow
Find in fileCtrl + F⌘ + F
Find in projectCtrl + Shift + F⌘ + Shift + F
File & project
Open fileCtrl + O⌘ + O
Save fileCtrl + S⌘ + S
Switch between open tabsCtrl + Tab⌘ + ` (backtick)
Help & documentation
Show help for symbol under cursorCtrl + F1⌘ + F1
Open RStudio “Keyboard Shortcuts Help”Alt + Shift + K⌥ + Shift + K
R Markdown
Knit documentCtrl + Shift + K⌘ + Shift + K

A few bonus tips

  • Autocomplete multiple packages: start typing, then hit Tab repeatedly to cycle suggestions.

  • Swap panes: use Alt + Shift + 1/2/3/4 (Windows) or ⌥ + Shift + 1/2/3/4 (Mac) to tile Source, Console, Environment, and Viewer.

  • Zoom in/out editor font: Ctrl + + / – (Windows) or ⌘ + + / – (Mac).

  • Quickly insert assignment (<-): pressing Alt + – (Windows) or Option + – (Mac) gives you <-.

    • ⌥ + Shift + K will open the little pop-up listing every shortcut, where you can search or browse by category.