Back to Practice
#0127
Order a Data Frame in R
EasyR15 min10 XP
Problem
Given df with name and score, return rows sorted by score descending.
Why This Matters
Sorting is necessary for top-N reports and sanity checks in analysis.
Examples
Example 1
InputA=5, B=9, C=7
OutputB, C, A
Negative score makes order sort descending.
Constraints
- Return the requested value exactly.
- Handle the stated edge cases.
- Keep the solution readable.
CodeR
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
InputA=5, B=9, C=7
ExpectedB, C, A
Negative score makes order sort descending.
Hidden Test Categories
tiesascending versionmultiple sort keys