Take your RStudio Hotkeys Online with a Text Expander

July 22, 2019
By

(This article was first published on George J. Mount, and kindly contributed to R-bloggers)

As a blogger and curriculum developer, I am often writing about R from a text editor instead of RStudio. I feared that working outside RStudio meant saying goodbye to fantastic hotkeys it provides. Isn’t there a way, I wondered, to set up a keyboard shortcut on my computer so that, for example, Alt + - would always return <- ?

I put out the call on LinkedIn (Let’s connect if we haven’t!), and fortunately my friend Mike Cantrell (a new data analyst himself) had the answer: a text expander. 

I consider myself a productivity geek, but this is a new application to me. A favorite of lawyers and technical writers, text expanders allow you to create custom “hotkeys” of varying length and complexity. Turning tcby into The Country's Best Yogurt, for example, is a nice early 90’s example of what text expanders can do.

New to R? Get your course checklist here.

But, readers, I know you’re more hungry for R productivity than frozen yogurt, so below I’ll walk through how to set up the assignment operator and pipe shortcuts instead. 

1. Download PhraseExpress

A bit of research showed a rather competitive market for text expanders, and I landed on PhraseExpress because it’s free for personal use and works on a variety of platforms and operating systems.  

2. Add a new phrase

The PhraseExpress interface is fairly straightforward, at least for the very basic task we are performing. On the main menu, click Phrases > New Phrase.

3. Describe and assign the shortcuts

By default, PhraseExpress will drop your Description attributes into Phrase content. That’s not the best option for our example: instead, complete the former with R assignment operator and the latter with <- . Be sure to include spaces before and after the assignment operator. 

Now you can assign this phrase to the Alt + - hotkey in the bottom window of this screen: 

One more while we’re here: Let’s make one for %>%, the “pipe” operator. Its RStudio shortcut is Ctrl + Shift + M.  

4. Code away! 

Adding these to PhraseExpress, we can now use these shortcuts anywhere on our device.

Where else to practice this but in the console of my very own DataCamp course?

5. Watch for conflicts

Keep in mind that these shortcuts will follow to all applications on your computer. So, you will run into conflict with any programs using Alt + - or Ctrl + Shift + M as keyboard shortcuts. 

Have you used text expanders before? If so, how? What advice would you give to new users? 

Ready to take your R journey? Check out my comprehensive course, R Explained for Excel Users.

To leave a comment for the author, please follow the link and comment on their blog: George J. Mount.

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.

Search R-bloggers

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)