Setup

How to set up for the workshop

Installing R

R is a programming language, and RStudio is a popular GUI / editor for R. Here we will install both.

Note

Whilst you can (and, in fact, I usually do) use a different text editor for R, I strongly recommend starting with RStudio.

R

Follow the installation instructions for your operating system below.

Go the the CRAN website, download the .pkg installer, and run it.

Alternatively, if you have Homebrew installed, you can run the following command in your terminal:

brew install r

Go to the CRAN website, download the .exe installer, and run it.

Run the following commands in your terminal:

# update indices
sudo apt update -qq
# install two helper packages we need
sudo apt install --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: 298A3A825C0D65DFD57CBB651716619E084DAB9
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 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

Followed by:

sudo apt install --no-install-recommends r-base

More detail on these instructions can be found on the CRAN website.

RStudio

Go to the RStudio website and download (and run) the appropriate installer for your operating system.

Mac users with homebrew installed can also run the following in their terminal:

brew install --cask rstudio

git

git itself

Installation instructions for git can be found on git-scm.com. Abridged instructions are included below.

Run the following command in your terminal:

git --version

If you don’t already have it installed, the terminal will prompt you to do so.

Click here, download the appropriate Standalone Installer .exe file (depending on whether your system is 32 or 64 bit), and run it.

Run the following command in your terminal:

sudo apt install git-all

GitHub

Account creation

You will need to create an account on GitHub (if you don’t already have one).

GitHub Command Line Interface (CLI)

Installation instructions for GitHub’s CLI can be found on the project’s GitHub repository. A summary of the most useful commands/instructions is below.

Run the following command in your terminal:

brew install gh

Download one of the .msi or .zip files from the bottom of this page and install.

Run the following command(s) in your terminal:

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh

Once installed, log in by running

gh auth login -w

SSH key

You should also (preferably) create an SSH key and add it to your account (again, if you haven’t already).