Self-Paced R Tutorials
A self-paced introduction to R for students with no programming experience, using simulated data laid out like All of Us Research Program data. Each notebook opens in Google Colab with the R runtime already selected and takes roughly 20 to 40 minutes.
Everyone starts with the Foundations, then follows one of two paths.
How to Use the Notebooks
- Click a notebook link below.
- Sign in with a Google account.
- Choose File > Save a copy in Drive and work in your copy.
- Run the cells in order from top to bottom. Each notebook ends with solutions and a link to the next one.
Foundations
| Notebook | Covers |
|---|---|
| F1: First Steps in R | Running code, arithmetic, variables, functions, reading error messages |
| F2: Vectors and Data Types | Vectors, numbers vs. text, TRUE/FALSE, dates, missing values |
| F3: Dataframes | Building and inspecting a table; one row per person or many |
| F4: Choosing Rows and Columns | Packages, select(), filter(), the pipe |
| F5: New Columns and Data Files | mutate(), if_else(), reading a CSV file, exploring a new dataset |
| F6: Combining Tables | Inner and left joins, missing values from joins, duplicated rows |
Path A: Write It Yourself
Students write the code.
| Notebook | Covers |
|---|---|
| A1: Cleaning Real Data | Recoding categories with if_else() and case_when() |
| A2: One Row per Person | Earliest record per person, merging three tables, long to wide |
| A3: Dates and New Variables | Date logic, exposure before diagnosis, analysis variables, saving |
| A4: Exploring and Plotting | Group summaries, histogram, box plot, scatter plot |
| A5: Statistical Tests | t-test, ANOVA, chi-square, Fisher’s exact test |
| A6: Regression | Linear and logistic regression, odds ratios |
Path B: AI-Assisted
Students describe what they want to an AI chat assistant, then read and check the code it returns.
| Notebook | Covers |
|---|---|
| B1: Your First Prompts | The describe-generate-read-run-check loop; what may be shared with an AI tool |
| B2: Building a Dataset with AI | Prompting for one row per person, merging, date logic; test cases |
| B3: Exploring and Plotting with AI | Summaries and plots by prompt; checking a plot against numbers |
| B4: Catching Mistakes | Debugging errors with AI; four mistakes that run without an error |
| B5: Statistics with AI | Choosing the test, reading output, odds ratios, moving to the Workbench |