R Package Installation in Linux

How to install R package binaries on Linux just like on Windows?

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.

R install packages from Shell

You may find littler useful. It is a command-line front-end / variant of R (which uses the R-embedding interface).

I use the install.r script all the time to install package from the shell. There is a second variant with more command-line argument parsing but it has an added dependency.

How to install R packages in RStudio Server

For whatever reason, there was an issue with the initial installation of Ubuntu Server, and the system was only registering that I had 4 GB on the drive. As a result, I reinstalled Ubuntu Server and it corrected itself, and now there is enough space to install packages.

Cannot install tseries and forecast packages in R

"gfortran: comando não encontrado": The gfortran compiler is missing.

On Linux, R builds packages from source. Therefore you need the gcc toolchain. To get the bare minimum, you may do:

sudo apt install build-essential gfortran

Some R packages need other Linux packages as well. If you try to install tidyverse for instance, I believe you need libicu-dev libbz2-dev libxml2-dev libcurl4-openssl-dev libssl-dev as well. In general, to find out which Linux package is missing, you will need to decipher the compilation error messages, and maybe check the source code or the web for additional information.



Related Topics



Leave a reply



Submit