Finding an observation that doesn't have a match
Left joins are really great for testing your assumptions about a data set and ensuring your data has integrity.
For example, the inventories
table has a version
column, for when a LEGO kit gets some kind of change or upgrade. It would be fair to assume that all sets
(which joins well with inventories
) would have at least a version 1. But let's test this assumption out in the following exercise.
This exercise is part of the course
Joining Data with dplyr
Exercise instructions
- Use a
left_join
to join togethersets
andinventory_version_1
using their common column. filter
for where theversion
column isNA
usingis.na
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
inventory_version_1 <- inventories %>%
filter(version == 1)
# Join versions to sets
sets %>%
___ %>%
# Filter for where version is na
___