Week 2 · Chapter 2 · MC 501 Research Methods for Mass Communications
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.
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.
Open Science Collaboration, 2015
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?
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.
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.
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.
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.
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.
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.
Every page below is on the Hub, under Resources in the top menu.
| For this | Open this |
|---|---|
| Installing R | Install R |
| Installing VS Code | Install VS Code |
| Making a GitHub account | GitHub Setup |
| Installing the course package | Install v2v |
| Building your workspace folder | Workspace Setup |
| All of it in one place | Resources |
Bookmark the Resources page tonight. Everything else is one click from there.
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.
Walked through one step at a time: GitHub Setup
One folder holds everything you write this term. You copy ours. You do not build it.
mc501-workspace and leave it PublicCtrl+Shift+P, or Cmd+Shift+P on a Mac, type Git: Clone, press Enter, and paste your new repository’s URLYou should see: your folder names down the left side of VS Code.
Walked through with more detail: Workspace Setup
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.
The file finishes by running a checker we wrote for this course:
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.
On Wilson et al. (2017), “Good enough practices in scientific computing”:
Two minutes to think, then we take it as a group.
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.
twitch_chat_sample: roughly 35,000 chat messages from a 50-channel corpustwitch_streams_sample: the stream snapshots for those channels, about 32,000 rowssetup() re-runs any time you suspect an installation problemrenv.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.
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)
setup() passing