Lecture 1A: Installation

September 2, 2025

Modified

September 8, 2025

Software and Troubleshooting

The goal of this lecture is to learn how to install and setup key software for use in the course.

TAs are available in class on Imagine Day from 9am-10:30am on Tuesday September 2nd to aid with installation. I highly recommend you join if you haven’t used RStudio, Jupyter, or GitHub before.

Note on PC vs Mac

You may encounter some material that implicitly assumes that you are using a Mac. For example, they might point you to a Terminal app, or ask you to use Unix commands like which or ls. Here is a cheatsheet that helps you convert between Windows command line (“DOS”) and Mac command line (“UNIX”). One thing that’s missing is the equivalent to Unix’s which; the closest equivalent in DOS is where.

Step 1: Install R and RStudio

R and RStudio The main programming language used in the class is R and our main IDE (a text editor with helpful features for writing and running code) is RStudio. The following instructions are adapted from Chapter 5 of Jenny Bryan’s “happy git” book.

  1. Install (or update to) the latest release R on your computer (4.5.1 currently):

  2. Install RStudio

Even if you already have R/RStudio, please update them to the most recent version!

Step 2: Install Jupyter and R Kernel

You will need another IDE for R (Jupyter Notebook) and an R kernel called ‘IR Kernel’ (needed to run R code within Jupyter) to work on the autograded worksheets. This is because the autograder we use plays well with Jupyter.

The following instructions are adapted from Rich Pauloo.

PC Installation:

  1. Install Anaconda from https://www.anaconda.com/download
    • Provide your email and an installation link will be sent to you
    • Install the full version of Anaconda (not miniconda)
  2. Install and setup the IR Kernel
    • Launch Command Prompt (CMD) and execute where R. The output should be the path to the file R.exe. Copy the path.
    • Open the Anaconda Prompt application. Enter the following command into Anaconda Prompt: cd file_path_here where file_path_here is replaced with the location of the R.exe that you just found/copied
    • Run R from within Anaconda Prompt by entering in R.exe. This opens an R session inside Anaconda Prompt. From here, enter the following commands in this order:
      • install.packages("IRkernel")
        • If you get an error, try install.packages("IRkernel", force = TRUE)
        • If prompted to select a IR kernel mirror, select 12 (CANADA - MB).
      • IRkernel::installspec()
  3. To verify that everything is working, open Anaconda Prompt and type jupyter lab. Jupyter Lab should launch and display both a Python and R kernel.

Having trouble? Check the instructions here: https://richpauloo.github.io/2018-05-16-Installing-the-R-kernel-in-Jupyter-Lab/.

Mac OS Installation:

  1. Install Anaconda from https://www.anaconda.com/download
    • Provide your email and an installation link will be sent to you
    • Install the full version of Anaconda (not miniconda)
  2. Install and setup the IR Kernel
    • Open R and navigate to the Console (see below).

      Your console may have a different appearance! Mine’s in dark mode.
    • Install the necessary packages by entering

      install.packages(c("repr", "IRdisplay", "evaluate", "crayon", "pbdZMQ", "devtools", "uuid", "digest"))

      devtools::install_github("IRkernel/IRkernel")

    • if you get an error, try devtools::install_github("IRkernel/IRkernel", force = TRUE)

    • Exit RStudio.

  3. Configure the IRkernel from within R
    • It’s important that these next commands are done from within the version of R that you want to link to Jupyter Lab (R version 5.4.1, for example)
    • Launch he Terminal application and type in which R (will probably output /usr/bin/R). Copy the path.
    • Then, open a Finder window and at the top of your screen hit Go -> go to folder and paste everything in the path except R (i.e., /usr/bin/). Scroll through and find R and open it.
    • In the R application, run IRkernel::installspec()
    • If prompted to choose a IRkernel mirror, select 12 (Canada - MB).
  4. Launch Anaconda, and open a Jupyter Notebook and you should see an R kernel available.

Having trouble? Check out https://richpauloo.github.io/2018-05-16-Installing-the-R-kernel-in-Jupyter-Lab/.

Step 3: Configure Git and GitHub

Git is a version control software. Github is a cloud-based platform (built on Git) for sharing code.

  1. Register a Github account at github.com (if you don’t already have one).

    • Create a username that uses your actual name. Shorter is better! For example, mine is grcetmpk. See this for more information.
    • You don’t need to download any apps.
  2. Install Git (more info here)

    • See if Git is already installed. For Mac OS, on the Terminal (Mac) type which git. For Windows, go to Command Prompt and type where git. If you get an error of git: command not found, you do not have git installed yet.
    • Windows:
      • Install Git for Windows (https://gitforwindows.org/)
      • When asked about “Adjusting your PATH environment”, make sure to select “Git from the command line and also from 3rd-party software”. Otherwise, keep the defaults.
    • Mac OS:
      • Install XCode Command Line Tools by opening Terminal and typing xcode-select --install (more info here)
      • In Terminal, enter git config. Click install.
  3. Configure Git: In RStudio, navigate to the Terminal or Shell (see below).

    If using Windows, you will have a Shell, not a Terminal.
  4. within the Terminal (Mac) or Shell (Windows) (Tools > Terminal/Shell) do:

    git config --global user.name "your_github_username"

    git config --global user.email "your_email_you_used_for_github@example.com"

    git config --global --list

    If you are having issues, you could use the usethis package in R. See here.

  5. Get your Personal Access Token (PAT)

    • Option 1: Go to to https://github.com/settings/tokens and click “Generate token”.
      • Choose Classic Token
      • Describe the token’s purpose in the Note field, e.g. “personal-macbook” or “Stat545Installation”.
      • Select “repo”, “user”, and “workflow” for scopes.
      • Ensure the token is valid for the entire semester (i.e., set the expiration for sometime in 2026).
      • Save this token somewhere so you can use it again later, such as a password manager.
    • Option 2: From R, execute usethis::create_github_token() (you may have to install the usethis package first by first running install.packages("usethis")).
      • Describe the token’s purpose in the Note field, e.g. “personal-macbook” or “stat545installation”.
      • Ensure the token is valid for the entire semester (i.e., set the expiration for sometime in 2026). Save this token somewhere so you can use it again later, such as a password manager.
  6. From R (in the console), run install.packages("gitcreds") if you haven’t already.

  7. Execute gitcreds::gitcreds_set() and enter the PAT that you just made when prompted.

Back to top