The Rank() function returns the positions of the numbers in a vector or list, as if the numbers were sorted from lowest to highest.
E = [1 -2 3 -4 0 5 1 8 -7];
R = Rank( E );
[9, 4, 2, 5, 7, 1, 3, 6, 8]
If E were sorted from lowest to highest, the first number would be -7. The position of -7 in E is 9.
The original matrix E can then be sorted using the matrix R as subscripts to E.
sortedE = E[R];
[-7,- 4, -2, 0, 1, 1, 3, 5, 8]
The Ranking Tie() function returns ranks for the values in a vector or list, with ranks for ties averaged. Similarly, Ranking() returns ranks for the values in a vector or list, but the ties are ranked arbitrarily.
E = [1 -2 3 -4 0 5 1 8 -7];
Ranking Tie( E );
[5.5, 3, 7, 2, 4, 8, 5.5, 9, 1]
E = [1 -2 3 -4 0 5 1 8 -7];
Ranking( E );
[5, 3, 7, 2, 4, 8, 6, 9, 1]
The Sort Ascending() and Sort Descending() functions sort vectors.
E = [1 -2 3 -4 0 5 1 8 -7];
Sort Ascending( E );
[-7 -4 -2 0 1 1 3 5 8]
E = [1 -2 3 -4 0 5 1 8 -7];
Sort Descending( E );
[8 5 3 1 1 0 -2 -4 -7]
If the argument is not a vector or list, an error message is generated.