March ’17 Tips and Tricks

March 30, 2017
By

(This article was first published on R Views, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

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)