Lab 00 · RStudio Setup
Do this before the first class on Monday, August 24. It should take about 20 minutes. Nothing here is graded — the point is to have a working setup before HW1.
If you get stuck, post on the course discussion board describing what you tried and what the error said, and we will help. Do not wait until the night HW1 is due.
1. Install R
Download and install R from https://cran.rstudio.com/. Choose the installer for your operating system, and 64-bit R if you are offered the choice.
2. Install RStudio
Download and install RStudio Desktop (free) from https://posit.co/download/rstudio-desktop/.
Install R first, then RStudio. RStudio is an editor that runs R; it does not include R itself.
3. Open RStudio and find the Console
Launch RStudio. You will see several panes. The one labelled
Console is where R evaluates code. Type the following
at the > prompt and press Enter:
R.version.stringYou should see a version number. If you see an error instead, R and RStudio are not talking to each other — post on the discussion board.
4. Install the packages we use most
In the Console (not in a document), run:
install.packages(c("tidyverse", "quarto", "scales"))This will take a few minutes and print a lot of output. That is normal. If you are asked whether to install from source, answering "no" is fine.
Then check that the core package loads:
library(tidyverse)A short startup message listing packages such as dplyr
and ggplot2 means it worked.
5. Make your first Quarto document
In RStudio: File → New File → Quarto Document…, give it any title, and click Create. RStudio opens a document with some example content.
Click the Render button at the top of the editor (or
press Cmd+Shift+K on macOS, Ctrl+Shift+K on Windows and Linux). RStudio
may ask to install the rmarkdown package — say yes.
A formatted HTML document should appear. If you can render, you are ready for HW1.
Assignments in this course are written in Quarto (.qmd).
For homework, submit the rendered PDF through Gradescope and keep your
.qmd source in your own course files.
6. Check that you can read the course data
The lectures and in-class checkpoints use the NOAA Storm Events teaching extract. Paste this into the Console to confirm you can reach it:
library(readr)
events <- read_csv(paste0(
"https://stat.cmu.edu/~sgallagh/courses/mads-fall-2026/",
"datavis-36613/data/noaa_storm_events_2024_clean.csv.gz"
))
dim(events)You should get a row and column count back. The final project uses a separate compensation archive, documented in the dataset guide — you will not need it until later in the mini.
Troubleshooting
"Package not found" when loading tidyverse. The
install step did not finish. Re-run
install.packages("tidyverse") and read the output for the
first error.
Render fails with a LaTeX error. You are rendering
to PDF without a LaTeX installation. Either render to HTML, or run
quarto install tinytex in the Terminal tab.
Download fails at step 6. Check the URL wrapped correctly with no stray spaces. On a restricted campus or corporate network, try again on a different connection.
Anything else. Post on the discussion board with your operating system, what you ran, and the exact error text.