Using binary R packages on linux
RStudio made their linux binary repositories available to everyone.
If you build your docker images from rocker/r-ver , they load much faster since last september. That is due to the switch to binary repositories provided by RStudio instead of source ones. Googling how to switch from CRAN to this binary repository yields mixed results, as most resources point to ‘RStudio Package Manager’, which is not what most people want (rspm is basically a local cran mirror, not a tool to download packages to end user machine).
In addition to providing binaries, RStudio mimics MRAN / checkpoint in a way, that you can pick a specific date and it will propose packages that were valid at that time.
If you have and older RStudio installation, the process is quite simple:
Check what repository you use:
> options('repos') $repos CRAN "https://cloud.r-project.org"
In my case, this just points to vanilla CRAN.
Navigate to RSPM client setup and select latest or freeze with specific date you are interested in.
Next, select binary reposotory
You may also change the target OS - RStudio supports a nice variety, including last 3 LTS versions of Ubuntu.
Once you are satisfied with the selection, copy the repository url, and in your RStudio navigate to Tools -> Global Options -> Packages and paste it either as primary or secondary repository, depending on your needs. I suggest to use binaries much as possible (primary) and compile only packages that can’t be obtained otherwise.
Congratulations, your RStudio is now set. Enjoy tidyverse installation in 30 seconds instead of 15 minutes :) You can test it by updating some packages you already have installed - the console should look like this
* installing *binary* package ‘zip’ ... * DONE (zip) * installing *binary* package ‘gitcreds’ ... * DONE (gitcreds)
Note: If you wish to use this repository outside of RStudio (ie, you have some package management scripts and such), you need to change repos option in your .RProfile or in the script in question. You can do that by pasting the following command (replace link with whatever you copied above)
options(repos = c(REPO_NAME = "https://packagemanager.rstudio.com/all/__linux__/focal/latest"))