## Introduction

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
**Numeric**or**Ordinal**data.

Please note this requires the **Data Stories** module or a **Displayr **license.

## Method

To use this transformation:

- Select one or more questions that are
**Numeric**and**Ordinal**variable or variable sets in the**Data Sources**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, and click
**OK**. - A new numeric R 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.