🚗 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.
In this code,
what role does selecting by name have? I am asking because I get similar results even when I don’t select by name,
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 withby = 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.