Back to Practice
#0210

Left Join Customers and Orders in R

MediumR25 min20 XP

Problem

Use a left join so customers without orders are still present with missing order values.

Why This Matters

Left joins are essential for analytics tables where the entity table must stay complete.

Examples

Example 1
Inputcustomers Ada and Ben; only Ada has an order
OutputAda has 50; Ben has NA

The customer table is preserved, and missing order values become NA.

Constraints

  • Return the exact requested result.
  • Handle common edge cases.
  • Keep the solution readable before optimizing.
CodeR
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputcustomers Ada and Ben; only Ada has an order
ExpectedAda has 50; Ben has NA

The customer table is preserved, and missing order values become NA.

Hidden Test Categories
empty or minimal inputrepeated valueslarger realistic input