1. Learn
  2. /
  3. Courses
  4. /
  5. Joining Data with dplyr

Connected

Exercise

Counting part colors

Sometimes you'll want to do some processing before you do a join, and prioritize keeping the second (right) table's rows instead. In this case, a right join is for you.

In this exercise, we'll count the part_cat_id from parts, before using a right_join to join with part_categories. The reason we do this is because we don't only want to know the count of part_cat_id in parts, but we also want to know if there are any part_cat_ids not present in parts.

Instructions 1/2

undefined XP
    1
    2
  • Use the count verb to count each part_cat_id in the parts table.
  • Use a right_join to join part_categories. You'll need to use the part_cat_id from the count and the id column from part_categories.