cumrank#

swordfish.function.cumrank()#

If X is a vector, for each element in X, return the position ranking from the first element to the current element. The result is of the same length as X. If ignoreNA = true, null values 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.

Parameters:
  • X (Constant) – A vector/ matrix.

  • 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.

  • tiesMethod (Constant, optional) –

    A string indicating how to rank the group of records with the same value (i.e., ties):

    • ’min’: lowest rank of the group

    • ’max’: highest rank of the group

    • ’average’: average rank of the group

  • percent (Constant, optional) – A Boolean value, indicating whether to display the returned rankings in percentile form. The default value is false.