Command Reference : Matrix Language Reference
  
 
@ranks
Syntax: @ranks(o, [order, ties])
Argument 1: vector, matrix, o
Argument 2: (optional) string, order
Argument 3: (optional) string, ties
Return: vector, matrix
Return the ranks of the elements of a matrix object o. The optional arguments control the behavior of the ranking.
Note that ranking a matrix ranks every element of the matrix and arranges the results by column to match the elements of the original matrix.
The first option controls the direction of the ranking:
“a” (ascending - default) or “d” (descending)
The second option controls tie-handling:
Ties are broken according to the setting of t: “i” (ignore), “f” (first), “l” (last), “a” (average - default), “r” randomize.
If you wish to specify tie-handling options, you must also specify the order option (e.g. ‘@ranks(x, “a”, “i”)’).
Example:
vector y = @ranks(x, "a", "i")
returns the unique integer ascending ranking for the data in X with ignoring ties.
See also @capplyranks, @rapplyranks, @sort, @permute, @colranks, and @rowranks.