Steven Sanderson joins on multiple columns:
Let’s start with a simple scenario. You have two data frames, and you want to merge them based on two columns:
IDandYear. The goal is to combine the data where theIDandYearvalues match in both data frames.
All of the examples here use the merge() function, so check them out.