11

Where can I install Rscript from? I need to run an R script from a php file using exec. However I need to install Rscript first.

tonytonov
  • 25,060
  • 16
  • 82
  • 98
jkjk
  • 5,777
  • 4
  • 20
  • 19
  • 2
    Did you know that the StackExchange has it's own forums specifically for Ubuntu? It's true, and I find them really helpful: askubuntu.com – john_science Aug 15 '12 at 23:04

4 Answers4

19

The main package for R is called r-base. For the scripting and command-line front-end see littler (or r-cran-littler in xenial (16.04LTS) and beyond):

sudo apt-get install littler
johnsyweb
  • 136,902
  • 23
  • 188
  • 247
  • I didn't downvote, but I think I understand why it happened to you after reading https://stackoverflow.com/a/21841167/1168342 – Fuhrmanator Feb 26 '19 at 14:52
6

Search the ubuntu repositories. Have you checked the littler package?

Kevin
  • 53,822
  • 15
  • 101
  • 132
2

The answers posted so far are generally useful, but they don't directly answer the question. I recently had the same question and discovered there is no rscript binary for Ubuntu. The r binary itself is used to execute scripts in batch mode as opposed to the separate rscript binary that I was using in OS X.

It appears you may be able to get an rscript binary from other sources (see http://craig-russell.co.uk/2012/05/08/install-r-on-ubuntu.html#.UwKWzkJdW2Q for example), but I'm not sure why you would need that when simple running "r script.r" from the command line works just fine.

Ryan Szrama
  • 200
  • 2
  • 7
1

I tried running Rscript in a fresh ubuntu installation (16.04.2 LTS) and got:

The program 'Rscript' is currently not installed. You can install it by typing: sudo apt install r-base-core

so, naturally, i ran sudo apt install r-base-core.

installation took a couple of minutes.

Later, i needed to install an R package, and realized i needed an R shell for that. running r returned:

The program 'r' is currently not installed. You can install it by typing: sudo apt install r-cran-littler

Again, i followed, this time it was quite faster.

I don't know if these are the correct steps to take (or why they would be wrong), but it's what the system led me to do.

Joey Baruch
  • 4,180
  • 6
  • 34
  • 48
  • 2
    This is a late comment, but the right way to run an R shell is with upper-case "R", which should be installed with `r-base`. – arredond Nov 22 '17 at 17:54