9

When I run install.packages("somepkg") on Linux (Ubuntu mostly), the installation process invovled building the R package from source which can be time consuming. Also it can be prone to failure due to missing development related Linux packages.

Is there a way to install compiled binaries like on Windows? I heard that it can be done, but couldn't find an easy to understand resource. Hope by asking here I will make the answer (if it exists) more googlable.

jww
  • 97,681
  • 90
  • 411
  • 885
xiaodai
  • 14,889
  • 18
  • 76
  • 140
  • Also see [How do I install an R package from source?](https://stackoverflow.com/q/1474081/608639), [R package installation in Linux](https://stackoverflow.com/q/22784182/608639), [What's the best way to install R packages on Linux?](https://stackoverflow.com/q/49251944/608639), etc. – jww Dec 18 '19 at 03:20

1 Answers1

16

Edit in 2023: Please see below for r2u -- this now exists on Ubuntu LTS, currently 20.04 and 22.04


It depends on whether binaries exist. Which, in turn, depends on which Linux distro and version you are running.

For Ubuntu 18.04 (and later, as they are compatible), you can use the Rutter PPAs which cover over four thousand CRAN package. This is described (albeit very briefly) at the top of this README at CRAN.

I also blogged about that (a few times) below my r4/ tag -- and because it didn't really "stick" amplified it again with short video plus slides, see this post. The video runs for about 5 mins during which we install rstan and tidyverse as binaries each with just one command and it takes about a good minute each (depending on bandwidth and disk speed, of course) pulling all dependencies in pre-built and in a fail-safe manner.

If this matches your needs, give it a try and please come to to the r-sig-debian list for questions.

If you are on a different Linux flavor then I unfortunately less sure if a comparable service exists.

Edit on 2020-09-17 As this was just upvoted and I was thus reminded of it, you now have better options and can get Linux binaries via install.packages("pkgname"). One way is RSPM, the other is BSPM. I have a first comparison blog post comparing both here (even with animated gif movies ;-)) and should be able to say more about BSPM "soon".

Edit on 2022-08-03 And going beyond RSPM and BSPM is the newer r2u which has been up for a few months and is currently serving around two thousand binaries a day. It is the best approach for binaries on Ubuntu LTS installations (currently: 20.04 and 22.04). See r2u for more including demos.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725