Module 0: Before You Arrive
Complete before the first day of class. This takes about 30–60 minutes. No assignment is due — just get set up and tell us where you’re starting from.
1. Install R and RStudio
Install both — R is the language, RStudio is the editor you’ll use to write it.
- R → cran.r-project.org (choose your OS)
- RStudio Desktop → posit.co/downloads (free version)
Open RStudio after installing. If you see a console prompt (>) you’re ready.
2. Get the Course Files
All lecture scripts, datasets, and materials live in a GitHub repository. You have two options:
Option A — Clone with Git (recommended)
If you have Git installed (git-scm.com):
git clone https://github.com/greymonroe/PLS_206.gitThis creates a PLS_206/ folder on your computer. To pull new files as the course progresses:
cd PLS_206
git pullOption B — Download as ZIP
Go to github.com/greymonroe/PLS_206, click the green Code button → Download ZIP. Re-download at the start of each week to get new files.
Set your working directory
Open RStudio, then set the working directory to the repo root so all relative file paths work:
# Replace with your actual path
setwd("/path/to/PLS_206")
# Verify it worked — you should see course files listed
list.files()The cleanest way: in RStudio go to File → Open Project and open the PLS_206/ folder as a project. RStudio will set the working directory automatically every time you open it.
3. Install Core Packages
Run this once in RStudio. It will take a few minutes.
install.packages(c(
"ggplot2", # visualization
"dplyr", # data manipulation
"tidyr", # reshaping data
"mgcv", # GAMs (Module 4)
"glmnet", # regularization (Module 6)
"MuMIn", # model selection (Module 5)
"vegan", # ordination / RDA (Module 10)
"lavaan", # SEM (Module 10)
"randomForest", # random forests (Module 9)
"lme4" # mixed effects models (Module 5)
))Confirm ggplot2 works:
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + theme_classic()You should see a scatter plot. If so, you’re ready.
4. Self-Assessment
There is no grade for this — it’s for your own awareness and so the instructor can calibrate the pace of Module 1.
R skills test
Open RStudio and try running this code from scratch — no notes, no Google:
# Can you do these without looking anything up?
x <- c(3, 7, 2, 9, 4)
mean(x)
x[x > 4]
df <- data.frame(group = c("A","A","B","B"), value = c(10, 12, 8, 6))
df[df$group == "A", ]
library(ggplot2)
ggplot(df, aes(x = group, y = value)) + geom_boxplot()How far did you get before hitting a wall? That’s your starting point — no wrong answer.
Submit a one-sentence summary in the Canvas Module 0 survey (e.g., “I got through the subsetting but couldn’t remember ggplot syntax”). This is anonymous to other students and just helps calibrate the pace of Module 1.
Starting from zero is completely fine — the course is designed for that. If you want interactive R practice before class, install Swirl: install.packages("swirl"); library(swirl); swirl() — it runs entirely in your R console, no account needed.
Quick self-check
Honestly rate yourself (1 = never heard of it, 5 = could teach it):
| Skill | Self-rating |
|---|---|
| Creating vectors and data frames in R | |
| Writing a for loop | |
Using ggplot2 |
|
Fitting a linear model with lm() |
|
| Interpreting a p-value | |
| Understanding what a residual is |
Bring this to the first class — we’ll use it to form activity groups.