

How to Execute and Format Code in RStudioĮxecuting code in your scripts can be very easy with the following shortcuts: If you need to type a path, you can use file path auto-complete which can be brought up by pressing the auto-completion shortcut ( Tab or Ctrl + Space ) from a pair of double or single quotes.īy default it starts in your working directory, you can navigate from the root location like in shell console starting with “/”, or step up levels in the directory tree by stacking “./” In case it doesn’t behave as you would expect, try tweaking it in code completion options. Note that for fuzzy matching to work with auto-completion, suggestion popup must be already active. Mastering this will allow you to type code much faster. It is especially useful for long function names that you use often.


It’s good to be aware that auto-completion in R, as well as some search fields, supports fuzzy matching which means that you don’t really have to type all the letters, you can skip any of them as long as those typed are in order and identify what you are looking for. Beside auto-completing functions and variables, you can also insert snippets. If the list is too long, try providing more letters to narrow it down. You can navigate through the suggestion list with arrows or just hover over the item before filling it in. To fill in the suggested phrase you have to press either Tab or Enter, pressing Ctrl + Space with auto-completion list open will close it.

You can adjust those settings in Global Options -> Code -> Completion. Code CompletionĪ suggestion list will pop up as you type or can be accessed manually by either pressing Tab or Ctrl + Space. Even basic tricks can have a great impact once you master using them, especially when combined together. It is crucial to be aware that there are some features that can make it both easier and faster. Usually, the first thing you have to do when you start working is creating some code. Let’s now discuss how you can improve how you work in those. The two that you will be mostly jumping between frequently are Source Editor ( 1 ) and Console ( 2 ). Preset windows: Help ( 3 ), History ( 4 ), Plots ( 5 ), or Environment ( 8 ). The only pane with a different access shortcut is the terminal ( Shift+Alt+t ). By adding a Shift to the combination you can also toggle maximize pane for the one that you are switching to at the same time, very handy if you need a broader perspective. It is achieved by pressing Ctrl (in this case also Control on Mac) and a number corresponding to the desired pane. Learning how to change focus between those utilized the most in a quick manner, and without using your pointing device, is a crucial skill for speeding up your workflow. ⌥ Option+Shift+K ( Alt+ Shift+ K) How to Navigate RStudioĭepending on your work, you will use at least a few RStudio panes on a regular basis. You can always look up the proper shortcuts on RStudio’s website or within RStudio itself with: Keep in mind that in some cases Ctrl will also be the control key on Mac which can be confusing. If you are a Mac user most of the shortcuts fall under this dependence:
SHORTCUT FOR MAC IN TEXT CITATION PC
*Note: Although we present both options in the gifs (PC and Mac shortcuts), we refer to PC shortcuts in the text.
