Joining three tables
You can string together multiple joins with inner_join and the pipe (%>%), both with which you are already very familiar!
We'll now connect sets, a table that tells us about each LEGO kit, with inventories, a table that tells us the specific version of a given set, and finally to inventory_parts, a table which tells us how many of each part is available in each LEGO kit.
So if you were building a Batman LEGO set, sets would tell you the name of the set, inventories would give you IDs for each of the versions of the set, and inventory_parts would tell you how many of each part would be in each version.
Latihan ini adalah bagian dari kursus
Joining Data with dplyr
Petunjuk latihan
- Combine the
inventoriestable with thesetstable. - Next, join the
inventory_partstable to the table you created in the previous join by the inventory IDs.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
sets %>%
# Add inventories using an inner join
___ %>%
# Add inventory_parts using an inner join
___