Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime 3 not interfacing with R (tried R-box and REPL)

Tags:

r

sublimetext3

Super basic question here:

I installed the R-box package in Sublime 3 with no problems. I changed the path to my R.app in the SublimeREPL.sublime-settings in Sublime, although this should not make a differece on Mac. I checked in Package Control -> R-Box:Select Program. It's set to R.

I'm simply unable to get Sublime to send code to R. Pressing Cmd+Enter does nothing (actually, it starts a new line on Sublime).

I'm running Sublime 3 on Maverics, and R version 3.2.1. But I had the same problems with Sublime 2 and a previous R version. I'm sure I'm missing something simple but I can't find any more information in the installation page.

like image 511
elisa Avatar asked Jul 31 '15 18:07

elisa


People also ask

How to send your code to R in Sublime Text?

You can also send your code to R within Sublime Text by using REPL. Cmd + Shift + P, then type “SublimeREPL: R” and that’s it. Please, comment your experience. You can be sure that trying this editor is worthwhile.

How do I install Sublime Text on Windows 10?

Cmd + Shift + P, then type “Install Package”, look for SublimeREPL and install it. Cmd + Shift + P, then type “Install Package”, look for R-Box and install it. Cmd + Shift + P, then type “Install Package”, look for SendTextPlus and install it. Cmd + Shift + P, then type “Install Package” look for R-Snippets and install it.

What programming languages does Sublime Text support?

Here at STATWORX, most of us are using Sublime Text on a daily basis. The editor – like many others of course – supports syntax highlighting for a variety of programming languages. Among others, our main tools like Python, R, and its extensions.

What IDE do you use for programming in R?

I use Sublime Text as my IDE of choice for all things not Python. It has a clean interface, it is easy to configure and is reasonably ligthweight. So when I had to develop some code in R for my work, I wanted to use this IDE to run blocks of code, build entire scripts and easily commit them to a shared repo with Git.


2 Answers

Open up an R console by pressing Ctrl+Shift+P and typing REPL R (after a few times you’ll be able to just type R and it will come up). You can open up two windows using (Alt+Shift+2) so you can have your R code on the left and your R console on the right.

As for running the code, once you have called the R console, you have three options: To run the current line or your selected lines, press Ctrl+Shift (release) then l. To run just the selected text, press Ctrl+Shift (release) then s. To run the entire file, press Ctrl+Shift (release) then f.

like image 187
scribbles Avatar answered Sep 17 '22 13:09

scribbles


Actually, I got an answer from the R-box developers, that worked perfectly: Close Sublime Text 3, then reopen it. Then check that at the bottom right of the window it says R Extended.

If not, you need to set the Syntax on the file:

cmd+shift+P Set Syntax: R Extended

like image 35
elisa Avatar answered Sep 21 '22 13:09

elisa