In R, type the merge() call that joins lines to products on sku and keeps every line, with NA where a SKU has no product.
In R, type the merge() call that joins lines to products on sku and keeps every line, with NA where a SKU has no product.
Answer
merge(lines, products, by = "sku", all.x = TRUE)
all.x = TRUE is the left join — 5 rows, D400 with NA product and price. Without it the default all = FALSE is an inner join with 4 rows.