1

The answers to this question: Determine if R package is available on Linux mention installing R packages from source, specifically in the context of R running on linux. For instance, pages such as this and this give specific instructions for installing packages on various linux systems, and StackOverflow questions such as: How do I install an R package from source? address the issue more generally. Finally, the answer in this SO question mentions that unix users tend to install packages from source.

I've used R on my university's CentOS linux server a decent bit and have always just added new packages using install.packages() from within R and specifying a CRAN repository. This generally works fine, though I do notice that it often takes far longer than when installing packages on my personal computer.

What would be the reason to:

(a) Download the .tar.gz file and specify its path via the path argument in install.packages() and/or

(b) Install the package directly from a command line call, as specified, for instance, here, here, and here

as opposed to just using install.package() from within R and specifying a given online repository?

Community
  • 1
  • 1
Michael Ohlrogge
  • 10,559
  • 5
  • 48
  • 76

1 Answers1

1

You hit an important overall question -- "should I install from a binary repository (where available) or should I install from source" -- but I fear you are a little confused about other aspects:

  • You rightly point to the Debian and Ubuntu READMEs. Ubuntu is particularly useful as Michael's (off-CRAN) PPA repos provide about 3200 package that are directly installable as binaries. Nothing is faster.

  • But that is for Ubuntu and you run CentOS. No soup for you.

  • So source installation it is.

  • And source installation is always from a .tar.gz and the various methods you list (command-line, install.packages(), ...) and alternative (Package tab in RStudio, say) are all equivalent as the all call the same underlying function.

It is really just different veneer for convenience.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Got it, this is very helpful. My particular context is that I'm about to set up my own Ubuntu server, so that is helpful to know about the Ubuntu-specific aspect. But, is it correct that whether I use those Ubuntu specific repos, or the general source install, the actual function of my packages will be the same, so it's just a matter of speed and convenience? – Michael Ohlrogge Apr 08 '17 at 18:31
  • 1
    No there is a difference between pre-built (ie .deb) and from source. I have another answer or two here on the site; there is also prior r-sig-debian discussion. Try some googling to unearth it, I do not have the links handy right now. – Dirk Eddelbuettel Apr 08 '17 at 19:14
  • 1
    Got it, thanks. The answers [here](http://stackoverflow.com/questions/9644699/difference-between-installing-a-package-from-source-and-from-compiled-binary) and [here](http://stackoverflow.com/questions/2170043/r-apt-get-install-r-cran-foo-vs-install-packagesfoo) were quite helpful. – Michael Ohlrogge Apr 08 '17 at 19:43