How to run R 4.0 in Docker — and 3 cool new R 4.0 features

There are some interesting changes and updates in R 4.0. Here I’ll take a look at three of them. Plus I’ll give you step-by-step instructions on installing R 4.0 so it won’t interfere with your existing R installation — by running R with Docker.

Docker is a platform for creating “containers” – completely self-contained, isolated environments on your computer. Think of them like a mini system on your system. They include their own operating system, and then anything you want to add to that – application software, scripts, data, etc. Containers are useful for a lot of things, but here I’ll focus on just one: testing new versions of software without screwing up your current local setup.

Running R 4.0 and the latest preview release of RStudio in a Docker container is pretty easy. If you don’t want to follow along with the Docker part of this tutorial, and you just want to see what’s new in R, scroll down to the “Three new R 4.0 features” section.

Run R 4.0 in a Docker container

If you would like to follow along, install desktop Docker on your system if you don’t already have it: Head to and download the right desktop version for your computer (Windows, Mac, or Linux). Then, launch it. You should see a whale Docker icon running somewhere on your system.

Docker icon Sharon Machlis, IDG

Docker icon

Next, we need a Docker image for R 4.0. You can think of a Docker image as a set of instructions to create a container with specific software included. Thanks to Adelmo Filho (a data scientist in Brazil) and the Rocker R Docker project, who provide some very useful Docker images. I modified their Docker images just slightly to make the one I used in this tutorial.

Here is the syntax to run a Docker image on your own system to create a container.

Copyright © 2020 IDG Communications, Inc.

Source link