Data Relations
Objectives
When we analyze data, we often need to combine data from different sources to get the full picture of what’s going on. For example, you might have a spreadsheet that lists students, their years, majors, and demographic information, and another spreadsheet that lists their grade history. How do you combine these tables into a single dataset? This week, we will discuss the family of “join” functions that allow us to combine different datasets. They use the overlap between datasets to smartly join them together so that you have everything in one place. This will make it easier to summarize and visualize your data going forward.
Readings
You should read this chapter before you come to class:
- Applied Data Skills - Chapter 5: Data Relations
Slides
Slides have been adapted from the textbook readings using Claude AI.
In-class exercises
We will follow along with the examples given in the textbook. Create an R project called data-relations, and save today’s work in a Quarto report called relations.qmd.
Weekly assignment
Solve the following problems using the concepts you have learned in class. As always, your Quarto report should be organized with headings and comments explaining your work.
Complete the exercise described in the chapter in section 5.11.
Using the
completesdataframe that you have created, compute some summary statistics:What is the mean and standard deviation for the number of points earned on the exam and essay?
Create a table counting how many students earned each grade level for each assessment (e.g., A1, A2, etc).
Now create a table counting how many students earned each grade for each assessment, collapsing across levels within an alphabet grade (e.g., A, B, C).
What proportion of students earned an A on both the exam and the essay?
What is the relationship between students’ grades on the essay and the exam? Use
ggplotto create a plot of this relationship.