by Sean Lopp
The RStudio IDE reached version 1.0 this month. The IDE has come a long way since the initial release 5 and a half years ago. Many major features have been built: projects, package building tools, notebooks. During that same period, often hidden in the shadows, a growing list of smaller features has been changing lives. In celebration of version 1.0 this post hopes to spread fanfare for a few of these easy-to-miss tools.
Tearable panes are anything but terrible. This feature allows users to tear off data view panes and source panes facilitating the use of multiple screens.
In the console it is possible to scroll through the command history by clicking
↑. The command history will be filtered as code is typed into the console:
The history pane shows a searchable list of commands that have been run. Commands can be written to the source pane or the console. No more copy and paste from the console to a script!
Rename in Scope
This feature makes it easy to rename all instances of a variable. The tool is context aware; changing ‘m’ to ‘m1’ won’t change ‘mtcars’ to ‘m1tcars’.
Gallery and Satellite View in Notebooks
A new feature built into R Notebooks, a code chunk that produces multiple plots will produce a gallery. The plots can be viewed by toggling between thumbnails. The gallery can be expanded into a new satellite window for closer inspection.
Save time scrolling with the code outline. This feature works for R Notebooks and traditional R scripts. In R Notebooks sections are delimited by the R Markdown headers. In R scripts sections are delimited by section comments (Try Code -> Insert Section).
Code snippets are a shortcut to insert common boilerplate code. For instance, type fun and then Tab to insert the skeleton code for a function definition. Then hit Tab to replace the necessary components. In addition to a rich set of defaults, custom code snippets can also be created. Learn more.
Many people know of RStudio’s rich set of tab complete options for functions and function arguments. Tab complete can also help find files and remove the hassle of writing out long path locations. Hit tab in between two double quotes (“ “) to open a file explorer.
Jump To Function Definition
Want to dig into the innards of a function? With the cursor on a function press F2 to jump to the function definition, even for functions in a package.
These are just a few of my favorite tricks. A comprehensive list is available in the RStudio IDE Cheatsheet or follow @rstudiotips on Twitter to learn a few tricks every week.