Are you getting into Data Science? Is R your chosen language? And RStudio is your go-to IDE? Well, I too made that choice a few days back, and it’s been really fun churning data. But, no matter what R programming tutorial you refer to, the first thing you would miss out are shortcuts. No one really focuses on shortcuts when starting out.
I for that matter, love using shortcuts. I like to focus on the work more, rather than try to find out how to write that line. so without further delay, let me get into my 5 favourite RStudio shortcuts:
5. Set or change the working directory
Now, every R programming tutorial will tell you to set your working directory as soon as you open the IDE. But there is a shortcut to this. Here’s how to crack it:
- Windows: Ctrl + Shift + H
- Mac: Ctrl + Shift + H
4. Open a file
Now you’ve set the working directory on RStudio. Cool! How about we start with the job? To open a file in RStudio all you have to do is:
- Windows: Ctrl + O
- Mac: Cmd + O
3. Clear console
Now, I have OCD. and it bothers me if my console has too much info. That brings me to my favourite shortcut on RStudio – clearing the console:
- Windows: Ctrl + L
- Mac: Ctrl + L
2. Run code
So, you’ve written a line of code, and now you want to run it. The beginners guide will ask you to click anywhere on the code, and then click on the “Run” button. But all you really need to do is:
- Windows: Ctrl + Enter
- Mac: Cmd + Return
1. Assignment operator/equal operator
I learned this gem from Matt Dancho’s course “Jumpstart with R“. When you assign a new operator with anything, your code would look something like this:
variable <- somestuff[1,2,3]
The “<-” can get a bit annoying. The shortcut is:
- Windows: Alt + –
- Mac: Option + –
And that’s a wrap. I hope this would help you streamline your work in RStudio. There is no hard and first rule on this. If you want to check out all the RStudio shortcuts, you can get there here.
If you want help or suggestions, feel free to connect with me on LinkedIn. Check out my article on why LinkedIn should be on your radar. If you’re starting out with Twitter, I’d suggest my Twitter growth hacking research.
If you’re into photography, check out my mini photo stories here.
Cover photo by Émile Perron on Unsplash.