Ranking is a statistical transformation that can be used on Numeric and Ordinal data that replaces the source values in the data with their rank value after being sorted. Consider this data set below. This article describes how to go from:
To a state where ranking within case will apply the rank transformation for each row in the data to yield the following:
Requirements
- A Displayr document containing Nominal - Multi, Ordinal - Multi, Numeric - Multi, or Numeric - Grid variable sets.
Method
- Select one or more variables that are Nominal - Multi, Ordinal - Multi, Numeric - Multi, or Numeric - Grid in Structure from the Data Sources tree.
- Hover and click + > Ready-Made New Variables > Scale Variable(s) > Ranks Within Case.
- A new numeric variable is created ranking within case.
For Numeric variables, the ranking is determined with the smallest value in the case taking the rank of 1, the second smallest taking the rank of 2, and so on until the values have been ranked. If there are any ties in the data, then they share the average rank. For Nominal or Ordinal variables, a similar procedure applies except that the categorical value attribute labels are mapped to the source numeric values to determine the ranking.