Installing R in a non-R environment, or updating to the most recent version
How to add a recent R version to any environment
Was this helpful?
How to add a recent R version to any environment
Was this helpful?
Code Ocean's use Ubuntu Linux as their operating system. Ubuntu's package manager, APT/apt-get (which can be operated using Code Ocean's user-friendly environment editor) provides as a set of packages to install different subsets of R, the primary one being r-base
.
Since R is a fast-moving project, the latest stable version isn’t always available from Ubuntu’s repositories. We can add the external repository maintained by CRAN to the apt-get configuration.
In the environment editor, click the gear icon () next to apt-get. This will open the apt-get configuration window.
In "additional sources", copy and paste deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
(for Ubuntu 20.04, please check the Hint below for other Ubuntu versions). This tells apt-get to search for packages on the R project's own repository.
In "GPG Keys", copy and paste E298A3A825C0D65DFD57CBB651716619E084DAB9
. This is a piece of information to guarantee the authenticity of the repository.
You should end up with something like this (for an image based on Ubuntu 20.04)
After you save your changes and get back to the environment editor, the last and crucial step is to add r-base-core
and r-base-dev
as an apt-get dependency. (You'll notice the various R installer options will show up automatically, which you can immediately add packages to. The system also adds some dependencies to apt-get as well)