Keys

Every join involves a pair of keys: one key in each data frame.

They typically play a different role depending on the data frame they belong to:

  • one is a data frame’s primary key: the variable or the set of variables that uniquely identifies each observation
  • the other is called a foreign key:
    • it corresponds to the primary key (same meaning, same number of variables)
    • its values can be repeated