Defining R Snippets

R Snippets are chunks of R code that you can assign to a keyboard shortcut. Architect ships with some default, simple snippets, but you can define customized snippets to perform far more complex tasks.

Access the snippets menu by typing 'R Code Snippets' into the Quick Search bar (Ctrl + 3), or navigate to it via the menus by selecting Window > Preferences > StatET > Run/Debug > R Code Snippets.

The above snippet allows you to switch the working directory of your active console at the push of a button. But to do so, we must first associate a key binding to the command. If you click the 'Keys' button at the bottom of the R Code Snippets window, you'll reach a menu for customizing keyboard shortcuts.

Find the desired snippet, then assign your command. Above, we assigned the command Ctrl + r, Ctrl + w to the change working directory snippet. This allows us to click on a folder in our Project Explorer, enter the chosen command, and our active console will change its working directory to that folder.