Back to Practice
#0193

Recode Status Values in R

EasyR15 min10 XP

Problem

Given a status vector containing active, Active, and inactive, normalize active variants to active.

Why This Matters

Cleaning category values is one of the first steps before summaries, joins, and plots.

Examples

Example 1
Inputactive, Active, inactive
Outputactive, active, inactive

Only the capitalized Active value is changed.

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
Inputactive, Active, inactive
Expectedactive, active, inactive

Only the capitalized Active value is changed.

Hidden Test Categories
minimal inputrepeated valueslarger realistic input