Take your RStudio Hotkeys Online with a Text Expander
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
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.