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:
- A Displayr document containing Numeric or Ordinal data.
To use this transformation:
- Select one or more questions that are Numeric and Ordinal variable or variable sets in the Data Sets tree.
- Navigate to Anything > Data > Variables > New > Ready-Made new Variables > Scale Variable(s) > Ranks Within Case.
- OPTIONAL: If your document contains more than one data file you will be prompted to select the data file. Click OK.
- Select the variable sets you want to transform, click OK.
- A new numeric R variable is created ranking within case.
For Numeric variables, the ranking is determined with the largest value in the variable taking the rank of 1, the second-largest 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.