Data lives in several tables that share a key. Invoices have a customer_id; the customer list has the name and city for each id. left_join() brings those columns across: invoices |> left_join(customer_list, by = "customer_id").
A left join keeps every row of the left table. Where a key has no match on the right, the new columns are NA, so an invoice from a customer missing from the list stays in, with no name.
The trap is a key that appears twice on the right. Each match becomes a row, so an invoice whose customer is listed twice appears twice, and every total built on the result is too big. Count rows before and after a join: a left join should never add any.
Every invoice gains its customer's columns; the row count should not change.