Back to Practice
#0194

Remove Duplicate Rows in R

EasyR15 min10 XP

Problem

Given a data frame, return rows with exact duplicates removed.

Why This Matters

Deduplication is a common cleaning step before counts, joins, and model training.

Examples

Example 1
Inputrows (1,a), (1,a), (2,b)
Outputrows (1,a), (2,b)

The second identical row is removed.

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
Inputrows (1,a), (1,a), (2,b)
Expectedrows (1,a), (2,b)

The second identical row is removed.

Hidden Test Categories
minimal inputrepeated valueslarger realistic input