This series of R tutorials introduces students to coding statistical concepts in R. These tutorials mostly rely on ggplot2’s data on diamonds.
I like using the diamonds data when teaching R because comparing diamond size to price is a simple and intuitive example for students. By using an intuitive example, students can focus their energy on developing new coding and analysis skills. Once students are more familiar with coding, I ask them to apply their new skills to more substantive examples. This strategy allows students to focus on learning one thing at a time.
I use these tutorials during in-person undergraduate methods labs, but annotate all tutorials so students can review them on their own. These tutorials are not all encompassing but serve as an applied introduction to statistical concepts. They can be used as a series or can easily be altered for independent-use/your own needs.
- Introduction to R.R provides an introduction to basic coding in R. In particular, it reviews the basic coding structure of R and summary statistics.
- Working with Data.R reviews importing and merging data, then covers best practices for beginning to work with data like visualization and summary statistics.
- Hypothesis Testing.R breaks down hypothesis testing into a series of steps, then applies those steps to this research question: is the size of a diamond related to its price? It reviews various types of bivariate analyses, directional hypothesis testing, and how to interpret results using additional examples.
- Introduction to OLS Regression.R continues to use the diamonds example, and reviews previously introduced bivariate tests like correlation. Then, it applies hypothesis testing to regression analysis and reviews how to interpret R’s output.
Download all of the files and necessary data here.