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

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.

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.

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

Related

How to run Python, R, Octave or Julia using BowPad?

I try using a very light-weighted editor BowPad to edit and run codes.
Take running R as an example, which has been added to Windows PATH Environment Variable D:\R\R-3.6.2\bin\x64
I try to take some following steps:
I built a test.r writing some testing line codes as 1+2; plot(1:10)
Menu --> Run --> Configure custom commands
Command Name: run R
Command Line: D:\R\R-3.6.2\bin\R.exe $(SEL_TEXT)
$(LINE) The line where the cursor is
$(POS) the position where the cursor is
$(TAB_PATH) the path to the file of the active tab
$(TAB_NAME) the file name without extension of the current tab
$(TAB_EXT) the file extension of the current tab
$(TAB_DIR) the directory of the file of the active tab
$(SEL_TEXT) the selected text or the word at the cursor position
$(SEL_TEXT_ESCAPED) like $(SEL_TEXT) but escaped, useful for urls
When I press to choose run R to run the code, something wrong happens!
It will open a Rterm(64-bit) window each time when I run R!
it shows RGUMENT '1+2' __ignored__ or ARGUMENT 'plot(1:10)' __ignored__
Did I missing something ? BTW, can we set some shortcuts keys for running Python, R, Octave or Julia?
Also, when I reach the homepage of BowPad for more information, little usage of this software can be found!
R.exe refers to Rterm. You can use Rgui.exe instead but that won't automatically process arguments. I think what you likely want is to send the selected text to a running R session rather than starting up a new R session each time.
To do that
download this file and optionally place it on your path https://raw.githubusercontent.com/ggrothendieck/batchfiles/master/clip2r.js
in the Bowpad Run | Configure window configure a Run R command as the following (or if clip2r.js is not on your path use the entire pathname). It should be just like this with no arguments.
clip2r.js
From the Windows cmd line if Rgui is running we see that tasklist | findstr Rgui finds Rgui as the R gui process and you can create additional js scripts by editing clip2r.js replacing Rgui in the js script with whatever is the appropriate word to locate python, julia, octave or other R front end assuming again that they are running.
Now to invoke it from within Bowpad:
ensure that your Rgui session is already running and
from within Bowpad select the code you want to run and copy it to the clipboard and then invoke Run R. For example, to run everything use ctrl A ctrl C ctrl R 0 assuming that Run R is in position 0 in the configure menu. Alternately use the mouse with the Ribbon.
Regarding the comment about difficulty finding help, it looks like Bowpad is based on Scintilla so the documentation for it and the related SciTE editor likely apply to Bowpad too. You can also check the Bowpad source code on github.

Opening the terminal in R

According to most articles on R the terminal simply shows up as a tab next to console in R or can be opened with shift+alt+R, however i still do not get anything
a picture of the workspacel do not get the terminal.
The "terminal"-tab next to "console" is for RStudio and you are not using RStudio. Thats why you cant use the Shortcut.

Atom and Hydrogen: Output and console

I'm a Python beginner and recently came across the Atom editor and the package Hydrogen, that implements the Jupyter notebook. I did so after realizing that running the notebook in Chrome consumed way too many resources and also seemed to be a bit slower.
However, the Atom editor and Hydrogen always output prints within a little frame in the code (see image). Unfortunately, it doesn't use the full window width. I also don't see any console/terminal for installing pip libraries.
Is there a way to have the output in a console below the code, just as in Jupyter, and to have a terminal?
this comes most certainly too late, but in case someone else searches for this:
hit control+shift+P / cmd+shift+P and type "toggle output area".

Sending code from Sublime Text 3 to R Terminal or SublimeREPL

I realise there are a few threads that already exist with regards to the second half of my question, but they don't seem to address the problem.
I am using R-Box, SendText, and SendCode to send lines of code from Sublime Text 3 to the R-GUI. However, I prefer working in Rterm rather than the GUI. Is there a way to modify settings in any of the three sublime text packages to send code to Rterm.exe instead?
In the mean time, I recently got a new laptop and can't seem to get Sublime Text 3 to send code to SublimeREPL properly. It decides to send the occasional line, but will not send some for no reason. Any ideas how to fix it?
Thanks in advance for your help.
I made Sublime/R-Box/SendCode work with Rterm by changing the settings in the RGui to SDI.
In RGui > Gui Settings > Select "SDI" > Click on "Save" > Close R Gui (this will show a warning)
Reopen R Gui to check that it opens Rterm.
In Sublime, working with SendCode/R-Box then will open the Rterm.
Use the standard settings in SendCode (In Sublime: Crtl+Alt+P > SendCode: Choose Program > Select "R Gui"), it works with R Term.
Note: You must open Rterm manually before using it from Sublime.
Let me know, please, if that worked for you.

Issues with Revolution R Open + Yosemite + Sublime Text

I have installed RRO on a new macbook pro 13" retina (two cores) & Yosemite.
I tried with RSTUDIO and R 25 (S. Urbinek notorious benchmark) and I got the test time down from ~31 s to a blazing 5 s (thanks to multithreading and Intel MKL). Marvellous!
The problems are with Sublime text. I use Sublime text 3 as text console more often than rstudio for a variety of reasons.
I use it in conjunction with the package R-Box to drive where I want to send the code to: either to the R console, or with SublimeREPL R to direct the code to Sublime itself splitting the screen in two and sending the code to the right hand of the screen where I run the R console.
Normally I configure R-Box user settings with R, and SublimeREPL specifying the R path as /usr/bin/R (see below).
Results (sadly)
R-Box & R does not work: it cannot find the RRO app (even changing
the name of the app from RRO to R it does not find it).
R-Box & SublimeREPL (i.e. the
console in the right side of the screen) shows the console OK, but there is no
visible prompt, hence it is of no use.
These are the R scripts that work with CRAN R:
# R-Box
{
"App": "R",
"osx":
{
"App": "SublimeREPL"
}
}
# SublimeREPL
{
"default_extend_env": {"PATH": "{PATH};/usr/bin/R"},
"show_transferred_text": true
}
(I posted this also on the RRO forun at https://groups.google.com/forum/#!topic/rropen/bK_YPqxhXsI)
PS: could somebody with tagging power create a tag for RRO (Revolution R Open)?
The first issues with R-Box is resolved changing RRO app name to R.app (alias didn't work and I had explicitly to change the name of the app).
As in my comment above, the second issue with SublimeREPL is resolved changing the setting of
echo = true
in the file at ~/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/R (otherwise set to false).
As the change it is not in a file "customisable" in the console one needs to probably change it at any new release of SublimeREPL.

Resources