J Rstudio cheatsheet
If you use a tool a lot, like we do it in this course, you should learn a few useful keyboard shortcuts and tricks. Here is a list of the most important ones
J.1 Keyboard shortcuts
Note: some of these are system-dependent. See the complete list at
Posit’s
page,
also available from menu Help -> Keyboard Shortcuts.
<-, the assignment operator:Alt + -/Option + -(alt-minus/option-minus). Only works within code, not within plain markdown!%>%, the pipe operator:Ctrl + Shift + M/⌘ + Shift + M- Open new script:
Ctrl + Shift + N/⌘ + Shift + N - zooming/focusing, for both Windows and Mac
(see the
View -> Panesmenu:)- switch to source:
Ctrl + 1 - zoom to source:
Ctrl + Shift + 1 - switch to console:
Ctrl + 2 - zoom to console:
Ctrl + Shift + 2 - bring back the default 4-pane view:
Ctrl + Shift + 0
- switch to source:
- Work with code
- indent:
Ctrl + I/⌘ + I - comment/uncomment:
Ctrl + Shift + C/⌘ + Shift + C
- indent:
- Rmarkdown
- insert code chunk:
Ctrl + Alt + I/⌘ + Option + I - knit:
Ctrl + Shift + K/⌘ + Shift + K - execute code chunk:
Ctrl + Shift + Enter/⌘ + Shift + Enter
- insert code chunk:
- run program (hover mouse over the buttons):
- source with echo:
Ctrl + Shift + Enter/⌘ + Shift + Enter - source without echo:
Ctrl + Shift + S/⌘ + Shift + S - run selection/statement:
Ctrl + Enter/⌘ + Enter - save current file:
Ctrl + S/⌘ + S(asks for name if saving for the first time).
- source with echo: