Description:
Compute the ranking of each member in a sequence.
Syntax:
A.ranks()
Note:
The function obtains the ranking of each member in sequence A and returns a sequence composed of rankings of the members, which by default are sorted in ascending order.
Parameters:
A |
A sequence |
Options:
@z |
Return a ranking according to members sorted in descending order. Here “z” is in lowercase. |
@i |
Deduplicate sequence A before getting the rankings. |
@s |
Perform average operation for each of the duplicate ranking and return the result, which could contain non-integers. Take the sequence [3,2,6,6,9] for example, a default ranking is [2,1,3,3,5]; but with @s option, the ranking becomes [2.0,1.0,(3+4)/2,(3+4)/2,5.0] after we get averages for the two duplicates. |
Return value:
An integer sequence composed of rankings of sequence A’s members
Example:
|
A |
|
1 |
=[2,1,3,4,8,5,2,0] |
|
2 |
=A1.ranks() |
[3,2,5,6,8,7,3,1]; rank members in ascending order |
3 |
=A1.ranks@z() |
[5,7,4,3,1,2,5,8]; rank members in descending order |
4 |
=A1.ranks@i() |
[3,2,4,5,7,6,3,1]; rankings with duplicates removed |
5 |
=A1.ranks@s() |
[3.5,2.0,5.0,6.0,8.0,7.0,3.5,1.0] ; get averages for duplicate rankings and then return the final result |
Related functions: