The scaffold decides where every file goes and what each file is named, so you do not have to. The five numbered files are the sections of your White Paper, already in order. The R/ folder holds the scripts you write.
Confirming the Stack
v2v::setup()
AURA: Check my setup in the R Companion checks R, Quarto, Git, and every package this course uses, and AURA: Install what is missing installs anything it flags. v2v::setup() runs the course package’s own version of the same check from the console.
You ran it once, when you installed the stack
Run it every time you open the project
It reports a missing piece before that piece interrupts your work
The Codebook Becomes a Document
The scaffold includes a file named codebook/codebook.qmd
In Chapter 8 your codebook was a plan on paper
From today it is the reference document every later step follows
Move your draft codebook into that file, then add a version line and a date
A codebook that renders cleanly is a codebook a coder can read
Exercise: Guess the Columns Before You Look
We are about to run glimpse(chat), which prints every column in the example chat table. Answer these three questions before we run it.
Name three columns you expect to find in a table of chat messages
The book’s example codebook needs the message text and the sender. Which columns does your own codebook need from your own source?
If a column your study depends on turns out to be missing from your data, what is your plan: find another source, or change the variable?
Line one loads the tidyverse. The next two lines fetch each example table and name it with <-.
The example data arrives through a function call, not a file path, which removes a whole category of beginner error. You get the working sample, not the full 2018 collection. Loading your own source from a file uses a different first line, read_csv(); every step after it is the same.
What a Function Is
Function: a named piece of code that does one job each time you call it, by writing its name followed by parentheses. Example: v2v::twitch_chat() hands back the chat table.
Whatever goes inside the parentheses tells the function what to work on, such as the file read_csv() should read
The Companion Writes This Block
Write R code in the R Companion, then Load the course Twitch corpus
Each row is one snapshot of one stream at one moment.
Counting What Channels Stream
streams %>%count(game, sort =TRUE)
# A tibble: 61 × 2
game n
<chr> <int>
1 Art 5298
2 Fortnite 3682
3 Just Chatting 2474
4 Hearthstone 2157
5 Pokemon: Let's Go, Pikachu!/Eevee! 1967
6 League of Legends 1952
# ℹ 55 more rows
count() tallies how often each value appears, and sort = TRUE puts the most common value first.
Confirming the Corpus
n_distinct(chat$channel)
[1] 50
The example corpus has fifty channels, as the book has said since Chapter 1
n_distinct(streams$channel) returns the same fifty
The fifty channels streamed 61 different game categories, so most channels move between games
Counting is how you check that the data is what you were told it is. Run the same checks on your own source.
When a Line Breaks
R returns an error message instead of a result
The usual causes are a misspelling, a package that is not loaded, or a stray bracket
This happens to everyone, and it says nothing about your ability
An error message is information, so read it before you retype anything
Copy the error text and run AURA: Explain an R error from the Command Palette for a plain-English reading
What Explain an R Error Shows
The panel quotes your error, says why it happens, and lists what to do
In this example, chat_dta is a misspelling of a name R never stored
Checkpoint
You should now have:
A project folder created by new_portfolio()
A clean v2v::setup() result
Your codebook in codebook/codebook.qmd, versioned and rendered
The chat and streams example tables loaded, and a glimpse() of each
Nothing changed in the data. Looking is all we did.
Before Thursday
Finish moving your codebook into codebook/codebook.qmd, then render it
Due Friday, October 30, 11:59 PM: Codebook and Qualitative Memo
The full codebook plus a 200 to 300 word memo
Bring your glimpse() output on Thursday
On Thursday we read the data against your codebook