denseRank#
- swordfish.function.denseRank()#
If X is a vector:
return the consecutive rank of each element in X based on the specified ascending order.
If ignoreNA = true, the null values are ignored in ranking and return NULL.
If X is a matrix, conduct the aforementioned calculation within each column of X. The result is a matrix with the same shape as X.
If X is a dictionary, the ranking is based on its values, and the ranks of all elements are returned.
Unlike denseRank, rank skips positions after equal rankings.
- Parameters:
X (Constant) – A vector/matrix/dictionary.
ascending (Constant, optional) – A Boolean value indicating whether to sort in ascending order. The default value is true.
ignoreNA (Constant, optional) – A Boolean value indicating whether null values are ignored in ranking. The default value is true. If set to false, null values are ranked as the minimum value.
percent (Constant, optional) – A Boolean value, indicating whether to display the returned rankings in percentile form. The default value is false.