Command Reference : Matrix Language Reference
  
 
@ranks
Ranks of the elements of a matrix or vector
Syntax: @ranks(m, [o, t])
m: matrix, vector
o: (optional) string
t: (optional) string
Return: matrix, vector
Return the ranks of the elements of a matrix object m. The optional arguments control the behavior of the ranking.
Note that ranking a matrix ranks every element of the matrix and arranges the results to match the elements of the original matrix, from upper left to lower right.
The o option controls the direction of the ranking:
“a” (ascending - default) or “d” (descending)
The t 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")).
Examples
vector y = @ranks(x, "a", "i")
returns the unique integer ascending ranking for the data in X with ignoring ties.
Cross-references
See also @sort, @capplyranks, @rapplyranks, @colranks, and @rowranks.