Check your understanding

Quiz

You have finished the workflow section: organizing work with RStudio Projects and here, pinning packages with renv, tracking changes with git, the modern 2026 toolchain, and a reproducible analysis from start to finish. This short quiz checks what stuck. Pick an answer to continue; you can retry until it clicks. The last two steps are live R, run them and tinker.

Question 1 of 8

Paths that do not break

Why prefer here("data", "sales.csv") over a hard-coded path like "C:/Users/me/project/data/sales.csv"?

Right. The same code runs on your laptop and a teammate's because the path is relative to the project, not your home folder.
It has nothing to do with encryption.
Question 2 of 8

What renv pins

What problem does renv solve?

Right. renv snapshots versions into a lockfile, so the project keeps working even as packages change over time.
renv and git solve different problems and are used together.
Question 3 of 8

What git tracks

What does git give you in a project?

Right. Each commit is a save point, so you can see what changed, when, and undo it if needed.
git versions files; it is not a data viewer.
Question 4 of 8

Why a project, not setwd

What is the main benefit of working inside an RStudio Project rather than calling setwd()?

Right. A Project sets a stable root automatically, which is what makes here() and shared code just work.
A Project removes the brittle, machine-specific setwd() step entirely.
Question 5 of 8

Data bigger than memory

Your dataset is too large to fit comfortably in R's memory. Which modern tool is built to query it without loading it all in?

Right. These engines work over data larger than memory and hand R just the small answer.
That loses data; the tools let you keep it all and query efficiently.
Question 6 of 8

Making randomness repeatable

Your analysis uses random sampling, and you need the exact same result every time you run it. What makes that happen?

Right. A fixed seed makes R's random sequence repeatable, so anyone running your code gets the same draw.
Speed does not affect which numbers come up.
Run it: reproducible randomness

set.seed in live R

Fix the seed, then draw five random numbers. Run it twice and notice you get the same five numbers, then change 42 to another number and watch them change.

RInteractive R
set.seed(42) sample(1:100, 5)

  

A fixed seed makes the random draw repeatable, the foundation of an analysis anyone can reproduce exactly.

Run it: a tiny reproducible analysis

A small pipeline in live R

Run a self-contained analysis: average miles-per-gallon by cylinder count, from a built-in dataset. Run it, then change mean to max.

RInteractive R
result <- aggregate(mpg ~ cyl, data = mtcars, FUN = mean) result

  

Because it uses a built-in dataset and no external state, this analysis gives the same answer for anyone who runs it, which is the whole point of a reproducible workflow.

Section complete

Excellent. You can keep paths portable with here(), pin versions with renv, track history with git, explain why a Project beats setwd(), reach for duckdb or arrow on big data, and make an analysis repeatable with set.seed(). That completes the New to R foundations: you now have a solid, reproducible command of base R and the modern toolchain.