March ’17 Tips and Tricks

[This article was first published on R Views, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This month’s Tips and Tricks focus is on file navigation. Many of these tips are straightforward – more tip than trick – but they can save quite a bit of time and frustration.

Open Recent

Please don’t spend time navigating through your folder structure to find a recent project or file.

Go to File/Function

RStudio automatically indexes all open files as well as files in the current project. The index includes function calls and objects within the files. To search the index, enter a search string in the Go to file/function window in the main toolbar or use the keyboard shortcut Ctrl + ..

The search supports fuzzy matching as long as the search string is in the correct order. For example, tiptric will match files and function names like march-tips-and-tricks.Rmd.

Find in File

In addition to the index, RStudio can quickly search the text of any file(s) for a string or regular expression. Open the Find in Files dialogue by navigating through the toolbar Edit -> Find in Files or using the keyboard shortcut Cmd / Ctrl + Shift + F.

Tabs

Close All and Close All Except Current

If you’re like me, you often end up with a whole bunch of files open and the number of tabs in the source pane causes anxiety. Don’t click through the tabs closing each individually.

Search for a Tab

If you don’t get anxiety from multiple tabs, you may find the keyboard shortcuts for switching between tabs helpful. My favorite is Ctrl + Shift + . which opens a search dialogue for the currently open tabs.

Set Working Directory

Sometimes I find myself inside a file and I have no idea where that file is. In this scenario, I often use the following trick to orient myself:

The other options, To Project Directory and To File Pane Location are also very helpful. These commands do not have key bindings by default, but you can create your own keyboard shortcuts for these actions: Tools -> Modify Keyboard Shortcuts...

File Pane: Go To Working Directory

After mastering tip 5, you can easily navigate from the file pane to the working directory:

File Pane: Go To Project Root Directory

Finally, it is really easy to go to the root of a project directory:

Be sure to follow @rstudiotips for more frequent updates. Tweet us @rstudio if there’s a file navigation trick you wish we’d implement!

To leave a comment for the author, please follow the link and comment on their blog: R Views.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)