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.rwriting some testing line codes as1 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
- Command Name:
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 Irun R! - it shows
RGUMENT '1 2' __ignored__orARGUMENT '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!
CodePudding user response:
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.jsFrom the Windows cmd line if Rgui is running we see that
tasklist | findstr Rguifinds 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.
