Installing R in a non-R environment, or updating to the most recent version
How to add a recent R version to any environment
Last updated
Was this helpful?
How to add a recent R version to any environment
Last updated
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
.
While Code Ocean's environments are based on a recent version of Ubuntu (18.04 code name "Bionic Beaver" or just "Bionic" – you'll see why this is important in a minute), the , 3.4.4. Luckily, there's a way to get newer versions of R to install on Code Ocean:
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 bionic-cran35/
(for R 3.6) or deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/
(for R 4.1). 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:
Afteryou save your changes and get back to the environment editor, the last and crucial step is to add r-base
as an apt-get dependency. (You'll notice the various R installer options will show up automatically, which you can immediately add packages to.)