install.packages("tidyverse")
install.packages("beepr")Data Skills for Psychology — Module 1
These slides are adapted from Applied Data Skills Ch. 1.
By the end of this class, you will be able to:
R is a programming language designed for statistics and data analysis.
Think of R as the engine of a car — it does all the work under the hood.
Why R?
RStudio is an Integrated Development Environment (IDE) — it makes working with R much easier.
If R is the engine, RStudio is the dashboard, steering wheel, and GPS all in one.
Warning
Always launch RStudio, not R directly!
Do this now!
If you haven’t installed R and RStudio yet, follow the installation guide.
Upper Left: Source
Lower Left: Console
Upper Right: Environment
Lower Right: Files/Plots/Help
Try it!
1 + 1 and press Enter?mean in the consoleNote
You can rearrange panes under Tools > Global Options > Pane Layout
You should always start with a clean workspace — no leftover objects from last time!
Do this now!
Go to Tools > Global Options > General:
Warning
You’ll need to change these settings every time you update RStudio.
R comes with built-in functions (“base R”) — like the default apps on your phone.
Packages are add-ons created by the R community — like apps you download from the App Store.
There are thousands of packages for:
install.packages()📲 Like downloading an app
library()🚀 Like launching an app
Important!
Never put install.packages() inside a script — only run it from the console. Why? You might accidentally reinstall and update a package, which could break your code.
A function is a named piece of reusable code. It takes arguments (inputs) and produces output.
tidyverse is a “meta-package” — a bundle of packages we’ll use throughout this course:
| Package | Purpose |
|---|---|
ggplot2 |
Data visualization |
dplyr |
Data manipulation |
tidyr |
Data tidying |
readr |
Reading data files |
stringr |
Working with text |
forcats |
Working with categories |
lubridate |
Working with dates |
There are several ways to get help with a function:
Every help page has the same structure: Description → Usage → Arguments → Details → Examples
One of RStudio’s best features! Start typing a function name and press Tab:
Try it!
Type sam in the console and press Tab. Select sample( and press Tab again to see the arguments.
sample()These two lines do the same thing:
Note
When learning, use named arguments — they make your code easier to read!
Objects store things — numbers, text, dates, results. Use <- to assign values:
| Object | Type | Key Rule |
|---|---|---|
name <- "Maureen" |
Character (text) | Must use quotes " " |
age <- 42 |
Numeric (number) | No quotes |
today <- Sys.Date() |
Date (dynamic) | Changes each day! |
halloween <- as.Date("2026-10-31") |
Date (fixed) | Wrapped in as.Date() |
Check the Environment pane — your objects should appear there!
Type this into your console
paste() to create a sentence like: “Hi [name] — there are [X] days until [event]!”| Resource | When to Use |
|---|---|
?function_name |
Know the function, need details |
??search_term |
Not sure which function to use |
| Google + “R” or “tidyverse” | Stuck on a concept |
| AI tools (responsibly!) | Need examples or explanations |
| Package vignettes | Want a tutorial-style guide |
| Your classmates! | Always a good idea |
AI tools can help with coding — but be careful while you’re building foundational skills.
Using AI to do your exercises is like getting a forklift to lift weights at the gym for you. It defeats the purpose!
Build your skills first, then use AI to accelerate your work — not replace your learning.
install.packages() = download once; library() = load each session? to learn about them<- to create them📖 Read: Chapter 1 of Applied Data Skills to lock in what we learned today
❓ Questions?