3.5.6.5 Rank


Description

This function takes a dataset, sorts it in ascending/descending order internally and returns the ranked indexes. If duplicated values exist in dataset, it will average the ranked indexes of the replica and reture the average number for each replica.

This function works similarly as sort.rank(Dataset1, Dataset2[, n]).

Syntax

dataset sort(dataset vd[, int n])

Parameter

vd

a dataset, or a column in Origin worksheet you want to rank.

n

Optional. Determine the sorting order. If n = 0 (default), vd is sorted in ascending order; if n = 1, sorted in descending order.

Return

Returns a dataset of ranked indexes in the specified sorting order.

Example

newbook;
col(A) = uniform(50, 5);
col(B) = rank(col(a),1);
col(B)[C]$ = "RANK";

See Also

sort, sort command, sort object.