Skip to content

RStudio shortcuts (Windows) – for cleaner and faster coding

November 26, 2014

RStudio has a number of keyboard shortcuts that make for cleaner and faster coding. I put all the Windows shortcuts that I use onto a single page so that I can pin them next to my computer.

RStudio shortcuts

(PDF)

You can also access the list of shortcuts with Shift + Alt + K so the sheet may be redundant to many. However, I found that having a physical copy next to my computer helped a lot while I was still learning the shortcuts.

Some favourites of mine are:

Using code sections/chunks – Use Ctrl+Shift+R to insert a code section and a popup box will appear for you to name that section. Ctrl+Alt+T runs the current code section. When you are done working on a code section you can ‘fold’ it up to improve the readability of your file (Alt+L is fold current code section, Alt+O is fold all sections).

Re-running code quickly – Ctrl + Shift + P will execute the same region of code that was just previously run with the changes made since then.

Deleting/moving stuff faster – Ctrl+D deletes an entire line. Ctrl + backspace deletes the current word as in most word processing software. Alt + up/down moves code up and down lines in the console while Shift+Alt+up/down copies lines up/down.

Switch between plots – To toggle between plots use Ctrl+Shift+PgUp/PgDn (It’s a lot faster than using the arrows above the plots!)

Advertisements

From → R

One Comment
  1. Thank you for taking the time to prepare this useful tool. I have not studied it yet, but is there a keyboard shortcut to move from one .R script to another in RStudio?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: