R Installation

R is available for Linux, Mac, and Windows operating systems. Here we will describe the necessary steps for installing the latest version of R (4.4.2) on each of them. If you encounter problems in any of the steps, also check the instructions on the CRAN website.

Installing R on Windows

Download the R version 4.4.2 executable from this link. Double-click the .exe file and follow the installer instructions.

After finishing, clicking on the R icon will show you a window similar to figure 1.

If there are errors in package installation

If you try to install a package and it doesn’t work, you might need to install Rtools. Download the recommended version and follow the installer instructions.

Installing R on MAC

Download the R version 4.4.2 executable from this link. This version is compatible with MacOS 11 or higher distributions. Double-click the .pkg file and follow the installer instructions.

After finishing, clicking on the R icon will show you a window similar to figure 1.

If there are errors in package installation

If you try to install a package and it doesn’t work, you might need to install XQuartz. Download the recommended version of the .pkg file, double-click it, and follow the installer instructions.

Installing R on Ubuntu

Here we will consider two versions of Ubuntu LTS (Long Term Support) distribution, but on the CRAN website you will also find instructions for debian, redhat, and suse.

Here we will cover version 22.04. If you’re unsure which distribution and version you’re using, use this command to find out:

lsb_release -a

First, ensure your system is updated:

sudo apt update
sudo apt upgrade

Install the dependencies:

sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

You might also need the keys:

wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc

Add the R repository:

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/"

Then just follow these commands:

sudo apt update
sudo apt-get install r-base r-base-core r-recommended r-base-dev

You can open R through the command line or by clicking the icon, and you’ll see something like:

Installing RStudio

RStudio is a more user-friendly R interface with very practical functionalities. The RStudio interface is also available for Windows, Mac, and Linux systems. For any of them, select the corresponding file on the website.

In the case of a Linux system, the downloaded file will have a .deb extension (for Ubuntu) or .rpm (for Fedora), and you just need to double-click the file for the Linux package manager to start the installation.

Posit cloud

If you don’t want to install R and RStudio on your computer, Posit cloud offers a way to use them in your internet browser without installation. To access it, just register on the website.

Using this platform is very practical, but it has the disadvantage of limited time and RAM memory that can be used. Slightly more “heavy” processes cannot be executed. For the course, the available RAM limit will be sufficient, but it might not be for your analyses after the course.