SigneMaten
SigneMaten

Reputation: 513

Unable to install the tidyverse

There is no package called 'tidyverse' is the error message I get after doing this:

install.packages('tidyverse', dependencies = T); 
install.packages('DBI', dependencies = T);
library(DBI);
library(tidyverse);

I use Ubuntu 18.04 and Rstudio.

Could anyone sort me out here, please?

Upvotes: 2

Views: 1977

Answers (2)

shs
shs

Reputation: 3901

The default setup in R on Linux is to compile packages from source since CRAN only provides binaries for macOS and Windows. This is not the recommended way to install packages on Ubuntu. As pointed out by @DirkEddelbuettel in his edit to his answer, you can use r2u and bspm to obtain binaries for all CRAN packages. This will require initial setup but result in a much better user experience. If you insist on compiling the tidyverse yourself, my old answer remains below.

Old answer

tidyverse has external dependencies that cannot be installed through R and that aren't preinstalled in Ubuntu. Install the following packages via the terminal:

sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev

Run install.packages("tidyverse") again after that.

You can find more help regarding this here.

Upvotes: 4

Dirk is no longer here
Dirk is no longer here

Reputation: 368201

You may find this blog post and associated video useful -- it shows how to install all of tidyverse on Ubuntu directly from prebuilt binaries with one command.

In short, that is what PPAs are good for. The associate slides have the relevant commands.

And once you do the required step of adding the two PPAs and running sudo apt-get update (again, both detailed in the slides) then all it takes is a single sudo apt-get install r-cran-tidyverse as the video shows.

Added bonus: because you install binaries that pre-made it is the fastest possible installation.

Edit three years later: We now have r2u which thanks to its use of bspm plus its complete set of CRAN binaries lets you just use install.packages("tidyverse") to install all packages as binaries along with all dependencies in a matter of seconds as shown in a few gifs on the site, my blog, and elsewhere. Plus anybody can try it in the browser via gitpod from the r2u site.

Upvotes: 4

Related Questions