orders <- data.frame(id = c(1, 2, 2, 3), value = 1:4)
customers <- data.frame(id = c(1, 2, 2, 4), name = c("A", "B1", "B2", "D"))
result <- merge(orders, customers, by = "id", all.x = TRUE)
# Explain why we got more rows than expected
join_explain(result, orders, customers, by = "id", type = "left")
Run the code above in your browser using DataLab