Lab: Setting Up Your Project

S4 · Chapter 2

Today’s Agenda

  • Install four programs: R, VS Code, Quarto, and Git
  • Prove all four are really there
  • Make your own copy of the course workspace and bring it to your laptop
  • Run the setup check file and read what it says
  • What to do when something breaks

What This Video Is For

  • We do one thing: get four programs onto your laptop, make your own copy of the course workspace, and run a file that proves it all works
  • Work along with me. Do not watch first and do it later
  • Pause whenever you need to, and rewind anything that goes past too fast
  • Nothing here is a race, and the video will wait

What You Will Have at the End

  • R, VS Code, Quarto, and Git installed and answering
  • Your own repository on GitHub, named mc451-workspace
  • That folder open in VS Code on your laptop
  • A setup check that runs and comes back green

Project Setup, 25 points, is due Friday, September 11, 11:59 PM.

Something Is Going to Break

  • Setup breaks in every section, every semester, for somebody
  • It is never because that person is bad at this
  • It is one version number disagreeing with another
  • Pause the video the moment something looks wrong. Do not push on and hope
  • Fifteen minutes stuck is enough
    • Then email me the exact wording of the error, or bring the laptop to office hours
    • Do not spend two hours on it, and do not wait until the night before it is due

Install 1 of 4: R

  • What it is: the language that does the counting and the statistics
  • Download it from cran.r-project.org
    • Take the newest release for your operating system and accept every default
  • On a Mac you have to pick the right file: Apple silicon or Intel
    • Open the Apple menu, choose About This Mac, and read the chip line
  • Start this download now, then keep watching, because it is the biggest of the four

Install 2 of 4: VS Code

  • What it is: the window you will actually work in, a free text editor from Microsoft
  • Download it from code.visualstudio.com and accept every default
  • On a Mac, open the downloaded file and drag Visual Studio Code into Applications
    • Do not run it out of the Downloads window
  • Your writing, your code, and your results all live here, so you stop switching between five programs to do one thing

Install 3 of 4: Quarto

  • What it is: the program that turns your file into a finished document
  • Download it from quarto.org/docs/get-started and accept every default
  • You write prose and code in one file, press render, and get back a document with the charts and numbers already in place

Install 4 of 4: Git

  • What it is: the program that keeps a history of your files, so nothing you write this semester can be lost
  • Windows: download it from git-scm.com/downloads
    • The installer asks a lot of questions, and Next is the right answer to every one
  • Mac: there is nothing to download
    • In Terminal, type git --version
    • If a box offers to install developer tools, click Install and wait. That box is Git arriving

Prove All Four Are Really There

Installers fail quietly. Open VS Code, then Terminal, New Terminal, and run these two commands:

quarto check
git --version
  • quarto check is Quarto’s own self test: it checks itself, then looks for R, and prints a line for each thing it finds
  • You should see green check marks from quarto check and a version number from Git
  • Windows only: R --version says “not recognized” even when R is fine, because the R installer does not add R to the command line
    • On a Mac it answers normally. Either way, quarto check is the check that counts

Exercise: While the Installers Run

  • We ask you to install four separate programs, not one. Say in one sentence what that says about how research software gets built, compared with Word or Photoshop
  • Think of the last time software failed you. Say whether you assumed the software was broken or that you were, and what made you pick that one
  • Name what you would need to see to believe this setup is going to be worth it

Two Words Before You Start

Repository (repo): a project folder that Git tracks, holding your files and the full history of every change to them. Example: the course workspace, which already has the course folder structure in it.

Clone: a copy of a repository that lives on your own computer, linked to the copy on GitHub. Example: in Step 2 you clone mc451-workspace into a folder on your laptop.

Step 1: Make Your Own Copy of the Workspace

  • Go to github.com/AURA-Lab-SIUE/v2v-workspace
  • Click the green Use this template, then Create a new repository
  • Name it mc451-workspace and leave it Public
  • Click Create repository
  • You should see: the same folders, now under your own username

Step 2: Bring It Down to Your Laptop

  • Nothing is on your computer yet. The copy exists only on GitHub
  • On your new repo, click the green Code button and copy the URL
  • In VS Code press Ctrl+Shift+P, or Cmd+Shift+P on a Mac, and a search bar drops down
  • Type Git: Clone, press Enter, and paste the URL
  • Pick a folder you will find again, such as Documents/MC451/
  • When VS Code asks, click Open
  • You should see: your folder names down the left side of VS Code

Step 3: Let VS Code Install the Extensions

  • A box appears in the bottom right: “This workspace has extension recommendations.”
  • Click Install All
    • That installs Quarto, R, and the AURA Lab R Companion, so everyone in the course works in the same environment
  • If the box already vanished, press Ctrl+Shift+X and search for Quarto, for R by REditorSupport, and for AURA Lab R Companion
  • If you are stuck, the Hub page Install VS Code walks through it

Step 4: Open the File We Wrote for You

  • Download it here, or from the blue button on the Resources page: aura-lab.siue.edu/v2v-hub/starters/00-check-your-setup.qmd
  • Save it into your mc451-workspace folder, then open it in VS Code
  • You do not have to write it, and you do not have to understand it
    • You click through it one gray box at a time, and it tells you what each box should print
  • Pause here and work through the whole file. The rest of this video assumes you have

What “Working” Looks Like

The file finishes by running a checker we wrote for this course:

library(v2v)
setup()
  • You want: green check marks all the way down Required R packages
  • Red next to Quarto or Git is fine if you have not reached those steps yet
  • Red under Required is the one that needs me
    • Email me that whole block of output exactly as it appears, rather than describing it
  • Then open the Command Palette and run Check my setup. It runs the same checklist, and its Install what is missing action installs any package it flags

When It Breaks

  • quarto: command not found means that terminal opened before Quarto finished installing
    • Close it and open a new one. This is the single most common problem in the whole setup
  • there is no package called 'v2v' means R is fine and the package is not there yet
    • Rerun the install step inside the check file, or run Check my setup and choose Install what is missing

When It Still Breaks

  • Red text in R is not automatically an error. R prints ordinary progress in red, so read the last line, not the color
  • GitHub asks for a password and refuses it. That is not your mistake: it wants a token now
    • Click through VS Code’s sign-in and it never asks again
  • Still stuck after fifteen minutes? On github.com open your workspace repository, click Code, Codespaces, then Create codespace on main. R, the packages, and the Companion are already installed there

Checkpoint

Every line should be true before you stop:

  • quarto check comes back clean, and git --version answers
  • Your own mc451-workspace exists on GitHub and is cloned into VS Code
  • The extensions are installed
  • 00-check-your-setup.qmd runs and setup() comes back green
  • Check my setup reports every course package installed

If any line is not true, do not leave it there. Email me the exact wording of the error, or bring the laptop to office hours. Closing the laptop and hoping is the one approach that never works.

Before Next Time

  • Project Setup, 25 points, is due Friday, September 11, 11:59 PM. Submit your repository URL
  • If the check still fails, come to office hours: Tuesday and Thursday, 12:30 to 1:45 in person in Dunham Hall 1017 (drop in), or remote Tu/W/Th 3:00 to 5:00 by appointment
  • Saving your work back to GitHub is the first thing we do next time. Everything you need is on the Hub
  • Read Chapter 3, Knowing and Knowing Well, before we meet

Questions, Comments, or Concerns?