🚗 Video too fast or too slow? Click the gear icon ⚙️ at the bottom-right to change the speed!


Lesson code

Please download the zip folder below to code along with the instructor!

After downloading, unzip the folder, open the RStudio Project file within, then open the “VIDEO_CODE_ALONG” script and type along with the instructor in the video above!

Lesson notes

The written guide below is an accompaniment to the lesson video. You may read through it if you prefer written tutorials to video content.

👋 Before you go, leave an anonymous rating & feedback

Average rating 4.9 / 5. Vote count: 19

No votes so far! Be the first to rate this post.

Please share any positive or negative feedback you may have.

Feedback is completely anonymous

2 Comments
Newest
Oldest Most Voted
Rachel

In this code,

left_join(x = test_info_xavier, y = demographic, by = "name")

what role does selecting by name have? I am asking because I get similar results even when I don’t select by name,

Joy

Hello Rachel! In this case, it is indeed true that by = "name" does not need to be specified, since “name” is the only column that appears in both the datasets that you are joining. In such cases, dplyr will automatically guess that it should join by the variables that appear in both datasets. If you don’t add the by argument, you will get a message saying “Joining with by = join_by(name)“, which is R’s way of telling you that it is automatically choosing a “key” column to join by. This is explain is section 5 of the lesson: https://the-graph-courses.github.io/fdar/FDAR_EN_joining_1/FDAR_EN_joining_1.html#5_Joining_syntax. The by argument becomes important when you have NO common names between two datasets, or if you have MULTIPLE columns in common but you only want to join by specific columns.

2
0
Questions or comments?x