R Companion Guide

Author

Nathan Favero

Published

December 5, 2026

Preface

This is a guide to learning R. The structure roughly follows the 2nd edition of Statistics Minus the Math: https://minusthemath.com/2e/

Even if you are not using that textbook, you are welcome to use this guide.

Some similar materials are available for learning Stata at the sister site: https://favero-nate.github.io/companion-guides/stata/

If you wish to download a PDF of the text from this guide, one is available here: https://favero-nate.github.io/companion-guides/r/R-Companion-Guide.pdf

Contents

The main contents of this site will consist of videos you can watch, organized into five parts that can be taught alone or alongside the first several chapters of Statistics Minus the Math. Each part has 2-3 videos, followed by an exercise where you can try out what you just learned with a new dataset.

Below each video, you’ll see a model script. Parts 1-3 also include a list of key concepts and syntax that will be helpful to know.

What this guide will and won’t cover

The goal here is dip your toes into the waters of programming in R. Thus, I will provide code that I hope is relatively easy to understand. I will not always follow best practices for coding because I believe doing so sometimes makes the code more difficult for a total beginner. You can learn those best practices later, and there are many great resources available to help (such as R4DS).

As such, I will not teach you to write “good code” (the kind that follows best practices) in these lessons. Instead, I hope you can write code that is good enough to show you some of the power of R and some of the ways data is being processed (without getting too overwhelmed if you are new to programming). Getting this basic familiarity with R will help prepare you to engage with more advanced resources that can teach you to write better code.

Accessing R

I assume you will be executing R code using Positron or RStudio. I use Positron in the video demonstrations. However, RStudio is a bit simpler (and therefore arguably better for beginners).

You have two options for how to get these programs running:

  1. You can download and install both R and Positron/RStudio on your computer. There are several installation guides available online, such as this one: https://moderndive.com/1-getting-started.html
  2. You can use Positron/RStudio in a web browser through Posit Cloud, which offers free accounts with limited features: https://posit.cloud/

Acknowledgements

I am grateful to Gül Sena Gökduman and Ethan McBride for research assistance in creating materials for this guide. I also thank Sangwon Ju for his constructive feedback on the project.