Learn
Joining Tables in R
Mismatched Joins

In our previous examples, there were always matching values when we were performing our joins. What happens when that isn’t true?

Let’s imagine that our products table is out of date and is missing the newest product: Product 5. What happens when someone orders it?

Instructions

1.

We’ve just released a new product with product_id equal to 5. People are ordering this product, but we haven’t updated the products table.

In notebook.Rmd, you’ll find two data frames: orders and products. Inspect these data frames using head().

Notice that the third order in orders is for the mysterious new product, but that there is no product_id 5 in products.

2.

Join the orders and products data frames with inner_join() and save the resulting data frame to the variable orders_products. View orders_products.

What happened to order_id 3?

Folder Icon

Take this course for free

Already have an account?