CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Joining Data with dplyr

Afficher le cours

Instructions

  • Use a left_join to join together sets and inventory_version_1 using their common column.
  • filter for where the version column is NA using is.na.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

inventory_version_1 <- inventories %>%
  filter(version == 1)

# Join versions to sets
sets %>%
  ___ %>%
  # Filter for where version is na
  ___
Modifier et exécuter le code