Running R scripts from Sublime Text

Here’s a quickie for running your R scripts directly from within Sublime Text by using the Build System functions.

Go to Tools -> Build System -> New Build System… and enter the following in the opened editor window:

{
    “shell_cmd”: “R –no-save –slave < $file"
}

Save it as something like “Run-R”, and it will appear in your Build System menu. Select it, and then you can run your script simply by pressing F7.

Note: I’ve only tested this on Linux so far. It’ll probably work OK on Mac OS X; Windows will probably need some adjustments to feed the script file into R. Let me know in the comments!

March 29, 2016   Tags: r, sublime

Leave a Reply