The Open Workspace

Week 2 · Chapter 2 · MC 501 Research Methods for Mass Communications

Dr. Alex Leith

Tonight

By the time you leave this room you will have four programs installed, talking to each other, and one file that proves it.

That is the whole goal. Everything else on these slides is me explaining why we bother.

Let me be honest about tonight

  • This is the least enjoyable evening of the semester. I am not going to pretend otherwise.
  • Installing software is not research. It is the tedious part that makes research possible.
  • Something will break for somebody in this room. It happens every section, every term.
  • When it breaks it is not a verdict on you. It is one version number disagreeing with another.
  • We fix it together, tonight, in the room. That is why we do it here and not at home.

The reason, in one sentence

Six weeks from now you will look at a number in your own draft and not remember where it came from.

Everything tonight exists to make that impossible.

What that looks like at scale

Open Science Collaboration, 2015

  • 270 researchers set out to redo 100 published psychology studies
  • Same published methods, similar participants, same analyses
  • Only 36 percent replicated at conventional thresholds
  • Among those that did, effect sizes averaged about half the original
  • These were not careless people. Their work simply was not built to be retraced.

What actually blocked them

  • Not fraud. Ordinary friction.
  • Methods sections did not say enough to re-run the analysis
  • Researchers had to email the original authors to ask
  • Some authors had moved. Some had lost the data.
  • Some had used software whose menus had since changed

Reproducibility, defined

Reproducibility means the analysis can be re-run, by you or by anyone else, and it produces the same result.

It is not a virtue. It is a property of how you stored your work.

The test is small and personal: can you recover, six months from now, exactly what produced a number?

Why clicking loses

  • SPSS, Excel, and JMP work through menus and dialog boxes
  • You click Analyze, then Compare Means, then One-Way ANOVA. The result appears.
  • The click history vanishes.
  • Redoing it next month means remembering which menus, in what order, with which options
  • Writing it down means describing every click in prose. Nobody does this well.

Why code wins

A script is a description of every step, in a language a computer can re-run.

The code is the methods section. That is the entire argument for everything we install tonight.

Reinhart and Rogoff, the spreadsheet error from last week, was caught only because the file was eventually shared. Written as code, it would have been visible from the first day.

Tool 1 of 4: VS Code

What it is: a text editor. Free, from Microsoft.

What it does for you: it is the one window where everything lives. Your writing, your code, your files, your output. You stop alt-tabbing between five programs.

You will spend more time in this than in anything else this term. It is the desk, not the work.

Tool 2 of 4: R

What it is: a programming language built for data and statistics.

What it does for you: it counts things, tests things, and draws charts, and it leaves a written record of having done so.

You are not becoming a programmer. You are learning to drive one tool for one job, the way you learned to drive a citation manager.

Tool 3 of 4: Quarto

What it is: a publishing system.

What it does for you: you write one file holding both your prose and your code, press render, and it produces a finished document with the charts already in place.

No more pasting a chart into Word, finding an error, redoing the chart, and pasting it again.

Tool 4 of 4: Git and GitHub

What it is: Git records every change you make. GitHub keeps that record online.

What it does for you: an undo button that reaches back months, and proof of when you did what.

It is also the closest thing our field has to a portfolio. Employers look. Use a professional username.

Install in this order

  1. R, from cran.r-project.org
  2. VS Code, from code.visualstudio.com
  3. The R extension inside VS Code, by REditorSupport
  4. Quarto, from quarto.org
  5. The Quarto extension inside VS Code
  6. Git, from git-scm.com

Click a name to open its download page. Steps 3 and 5 happen inside VS Code, not in a browser.

The order is not decorative. Each one looks for the one before it and gets confused when it is missing.

Make your GitHub account

GitHub is a website that stores your files and their history. Git is the program on your laptop; GitHub is the copy online. You need the account before Git is any use to you.

  1. Sign up at github.com/signup. Choose a professional username, because employers will read it.
  2. Add a profile photo and a short profile README saying who you are and what you study.
  3. Claim the free Student Developer Pack with your SIUE email.

Walked through one step at a time: GitHub Setup

Make your workspace folder

One folder holds everything you write this term. You copy ours. You do not build it.

  1. Open the v2v-workspace template
  2. Click the green Use this template, then Create a new repository. Name it mc501-workspace and leave it Public
  3. In VS Code press Ctrl+Shift+P, or Cmd+Shift+P on a Mac, type Git: Clone, press Enter, and paste your new repository’s URL

You should see: your folder names down the left side of VS Code.

Walked through with more detail: Workspace Setup

Now open the setup file

It is already in your workspace, in the top folder: 00-check-your-setup.qmd. Click it.

No workspace yet? Download the file on its own from the Resources page, or click it here:

aura-lab.siue.edu/v2v-hub/starters/00-check-your-setup.qmd

It walks you through the rest, one gray box at a time, and it tells you what each box should print.

Work through it. I am coming round the room. Raise a hand the moment something looks wrong, not at the end.

What “working” looks like

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

library(v2v)
setup()

You want a list of green check marks under Required R packages.

Red marks next to Quarto or Git are expected tonight if you have not finished those steps. Red under Required is the one that needs me.

When it breaks

  • Red text in R is not automatically an error. R prints ordinary progress in red. Read the last line, not the color.
  • Close VS Code completely and reopen it. This genuinely fixes a lot.
  • If R asks “which would you like to update”, type 1 and press Enter.
  • Send me the exact wording of the error, not a paraphrase. The wording is the diagnosis.
  • Fifteen minutes stuck, then ask. Not two hours.

Discussion

On Wilson et al. (2017), “Good enough practices in scientific computing”:

  • The title concedes something. What work is “good enough” doing, and who is it for?
  • Which of their practices would survive contact with your actual working habits, and which would you quietly abandon by October?
  • They write for the researcher with no formal computing training. Does that framing make the advice more usable, or does it lower the ceiling?
  • Bring one practice you think is oversold.

Two minutes to think, then we take it as a group.

First contact with the data

stream_log, November 2018

channel game viewers date
sodapoppin Marble It Up! 27,934 1542578200214
xqcow Just Chatting 19,381 1542578200240
forsen Artifact 15,300 1542578200273
giantwaffle Rocket League 4,697 1542578200423
sodapoppin Marble It Up! 28,076 1542578261145
xqcow Just Chatting 19,231 1542578261186

Look before you read on. Resist doing anything with it.

The data moves

  • This is a time series, not a snapshot. Four channels recur across these rows.
  • Sodapoppin climbs 27,934, then 28,076, then 28,203
  • That is 269 viewers in 122 seconds, an audience growing close to real time
  • xQc lost 150 between the first two snapshots, then held. Forsen lost 120.
  • Each number is a real moment: a clip went viral, a raid arrived, bandwidth dropped

The timestamps are not dates

  • That date column is a thirteen-digit integer: 1542578200214
  • The next row, 26 milliseconds later, reads 1542578200240
  • Unix epoch time: milliseconds since midnight, January 1, 1970
  • The gap between sodapoppin’s first two rows is 60,931, about a minute
  • Converting it is a wrangling step, not a research question. Chapter 11 handles it.

Titles are themselves data

  • xQc: “RANK 1 GAMER ~ NO PLAN (help me)”, which is a joke
  • Forsen is giving away keys for a card game called Artifact
  • Giantwaffle performs etiquette: “No Smoking in Chat”
  • One title even carries a literal line break, because the streamer’s software let it through
  • These are content analysis opportunities sitting in a column you might dismiss as metadata

What the package gives you

  • twitch_chat_sample: roughly 35,000 chat messages from a 50-channel corpus
  • twitch_streams_sample: the stream snapshots for those channels, about 32,000 rows
  • Helpers that wrap loading, codebook skeletons, reliability metrics, and diagnostics
  • The helpers are not magic. They keep the concept from being buried under setup code.
  • setup() re-runs any time you suspect an installation problem

Lock the versions

renv.lock is a file recording the exact version of every package your analysis used.

Without it, someone re-running your work next year may get different numbers, because a package changed underneath them and nobody noticed.

renv::init()

Run it before your first line of analysis code. Commit it before you collect your first data point.

“Back up (almost) everything created by a human being as soon as it is created. This includes scripts and programs of all kinds, software packages that your project depends on, and documentation.”

Wilson et al. (2017, p. 12)

Before Week 3

  • Due Monday, September 7, 11:59 PM: your GitHub Profile, 25 points, with the stack installed and setup() passing
  • Read Chapter 3 (Ethics) and Chapter 4 (Intelligence Gathering), graduate edition toggle on
  • Read the assigned article: Nosek et al. (2018), “The preregistration revolution”
  • Write your journal entry, 450 to 500 words, engaging both the chapters and the reading
  • Next week is searching. Bring a topic you might actually search.