The R Console and Sublime Text

Below find instruction as to how to install R and the Sublime Text 3 text editor and how to get Sublime Text to communicate with the R console. Let’s start with the instructions for Windows (which are slighlty more complicated). For the instructions for the Mac you’ll need to scroll down a bit.


  1. Install R (the current version is R-3.4.3), making sure to choose the option customized start-up and SDI when prompted. Also, pay attention to where R is being installed. Most likely it will be installed here:
    C:\Program Files\R\R-3.4.3

  2. Install Sublime Text 3 (the current version is ST3 Build 3143).

  3. Navigate you web-browser to: and copy the bit of python code – the mumbo-jumbo you see below:

  4. Start (open) the Sublime Text 3 application and press the Ctrl and ~ keys. This will open a field at the bottom of the text editor into which you need to paste the python code you copied as per the previous step. Press Enter and finally Esc to finish the installation of the Package Control system.

  5. In Sublime Text 3 press Ctrl and Shift and P. This shortcut will open a menu (called the Command Palette). Type install and choose the first option to install packages.

  6. This should open another menu containing a list of a bunch of packages you can install as add-ons to enhance the functionality of Sublime Text. We are looking for a package called R-Box. So type: R-Box, choose the R-box option, and press Enter. This will install the add-on package.

  7. Now repeat steps 5. and 6. to install an add-on package called SendCode.
  8. If your PC behaved, both R-Box and SendCode will have been installed. Next, navigate to the settings for the R-Box package by clicking: Preferences > Package Settings > R-Box > Settings.

  9. A new window (as shown below will open). Copy all of the code on the left hand panel into the panel on the right.

  10. Replace the set of square brackets [] in the pasted user settings in the right panel with the path of the Rgui executable. Make sure the path is in quotation marks and do use two forward slashes \\ instead of one. The default location of the Rgui.exe is: C:\Program Files\R\R-3.4.3\bin\x64\Rgui.exe. Press Ctrl and S to save and then close the settings window. See below:

  11. Now navigate to the settings for SendCode package via the menu Preferences > Package Settings > SendCode > Settings as shown in Step 8 above. A new window will open. Again copy and paste the code from the left panel into the empty panel on the right, as shown below.

  12. In the right hand panel in line 2 and line 9 replace the term cmder with a R. Press Ctrl and S to save and then close the settings window. See below:

  13. Return to the untitled document open in Sublime Text and click on the bottom right corner where it says Plain Text and select R-Box > R Extended. If selected, R Extended will appear in the bottom right corner instead of Plain Text.

  14. Now Sublime Text 3 is able to send commands or code directly to the R console. Simply, type your instructions – for example (25 + 2) * 1981 into the R Extended document in Sublime Text and press Ctrl and Enter. Any code in the same line as your cursor or any highlighted code will be transferred upon pressing the Ctrl and Enter key-combination.


  1. Things are slightly less complicated for Mac users. First install both R (the latest version is: R-3.4.3) and Sublime Text 3 (the latest version is: Build 3143).

  2. Next execute Steps 3 through 7 from the Windows instructions above. They are almost exactly the same. The only difference is that on the Mac the Sublime Text 3 shortcut to open the command palette is: Command, Shift, and P (not Ctrl, Shift, and P).

  3. Skip Steps 8 through 10 of the Windows instructions and navigate to the Sublime Text 3 settings for the SendCode add-on by clicking in the menu bar on Sublime Text > Preferences > Package Settings > SendCode > Settings. See below:

  4. A new window containing the default settings on the will appear like so:

  5. Copy the default settings from the panel on the left into the panel on the right and replace the word terminal with R on lines 2 and 9. Press Command and S to save and close the settings window.

  6. Complete Steps 13 and 14 from the Windows instructions to ensure that all is working as intended. In other words, open a new document in Sublime Text. Set the language to R Extended. Enter some instructions – say 99 + 321 – and press Command and Enter. If not already open, the R console will open (check your application dock) and execute the instructions received from Sublime Text 3.