Back to Practice
#0109

Subset Data Frame With Conditions

EasyR15 min10 XP

Problem

Given a data frame sales with region and revenue, keep rows where region is "South" and revenue is at least 100.

Why This Matters

Data-frame filtering is one of the first practical R skills needed for analysis.

Examples

Example 1
InputSouth 120, North 200, South 80
Outputonly South 120

Both conditions must be true.

Constraints

  • Return the exact structure requested.
  • Handle the edge cases mentioned in the prompt.
  • Prefer clear logic over clever one-liners.
CodeR
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
InputSouth 120, North 200, South 80
Expectedonly South 120

Both conditions must be true.

Hidden Test Categories
no matching rowsall matching rowsOR condition variant