0

I have R programming environment in Ubuntu 16.04 LTS. I also have Sublime Text 2 and I want to run R programs in it. I don't have any IDE like RStudio and even I dont want to use them as I am just a novice in R programming. So please suggest me a method to run R programs directly from Sublime Text 2.

  • How do you run it from command-line? – idleberg Jun 16 '16 at 9:06
  • I type R in the terminal. Then R shell opens up in the terminal and I do a bit of programming stuff there. – Gautam Vashisht Jun 27 '16 at 6:28
1

I'm not familiar with R, but according to this answer, you run a script from command-line using Rscript. With Rscript installed, you can then create a custom build system for Sublime Text (Tools > Build System > New Build System). At its most basic, it would look something like this:

{
  "cmd": ["Rscript", "$file"],
  "selector": "source.r, source.R",
  "working_dir": "${project_path:${folder}}",
}

Now, you can build your R script by pressing F7 or from Tools > Build.

  • Thanks a lot for the answer! It worked nicely. But in the output console, I am unable to give any input from the user. Can you tell me how to do this? – Gautam Vashisht Jun 28 '16 at 14:19
  • That's not possible in the console, but I think SublimeREPL lets you do that. – idleberg Jun 28 '16 at 14:27
  • Ok! Well thanks a lot for your help! I will use SublimeREPL for R programming. – Gautam Vashisht Jun 29 '16 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.