Lab: Setting Up Your Project

S4 · Chapter 2 · MC 451 Research Methods in Mass Media

Dr. Alex Leith

What this video is for

We are doing one thing: getting four programs onto your laptop, making your own copy of the course workspace, and running 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

Project Setup · 25 points · due Friday, September 11

  • 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

Something is going to break

  • It 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. Not two hours, and not the night before it is due.

Install 1 of 4: R

What it is: the language that does the counting and the statistics.

Download 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. Apple menu, About This Mac, and read the chip.

Start this download now, then keep watching. It is the biggest of the four.

Install 2 of 4: VS Code

What it is: the window you will actually work in. It is a text editor, free, from Microsoft.

Download from code.visualstudio.com. 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 thing that turns your file into a finished document.

Download from quarto.org/docs/get-started. Accept every default.

You write prose and code in one file, press render, and get back a document with the charts and numbers already dropped into 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 from git-scm.com/downloads. The installer asks a lot of questions. Next is the right answer to every one of them.

Mac: 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:

quarto check
git --version

quarto check is Quarto’s own self test. It checks itself, then goes looking 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: typing R --version says “not recognized” even when R is perfectly 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.

Your turn

While the installers run:

  • We are asking you to install four separate programs, not one. What does that tell you about how research software gets built, compared with Word or Photoshop?
  • Think of the last time software failed you. Did you assume the software was broken, or that you were? What made you pick that one?
  • What would you need to see to believe that this is going to be worth it?

Answer these in your journal this week. We pick them up when we next meet.

Step 1: make your own copy of the workspace

A repository, or repo, is just a folder that Git is watching. Ours has the course folder structure already in it.

Go to github.com/AURA-Lab-SIUE/v2v-workspace.

  • Click the green Use this template, then Create a new repository
  • Name it mc451-workspace. 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. 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. A search bar drops down.
  • Type Git: Clone, press Enter, paste the URL
  • Pick a folder you will find again. Documents/MC451/ is a fine answer.
  • 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 is Quarto, R, and GitLens, and it means everyone in the course is working in the same environment.

If the box already vanished, press Ctrl+Shift+X and search for Quarto and for R by REditorSupport. Stuck? Install VS Code

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. 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.

When it breaks

  • quarto: command not found. That terminal opened before Quarto finished installing. Close it, open a new one. This is the single most common problem in the whole setup.
  • there is no package called 'v2v'. R is fine, the package is not there yet. Rerun the install step inside the check file.
  • Red text in R is not automatically an error. R prints ordinary progress in red. Read the last line, not the color.
  • GitHub asks for a password and refuses it. Not your mistake. It wants a token now. Click through VS Code’s sign-in and it never asks again.

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 installed
  • 00-check-your-setup.qmd runs and setup() comes back green

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 and 3:30 to 5:00, Dunham Hall 1017. Drop in.
  • 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