rowRank#

swordfish.function.rowRank()#

Conduct the following operation within each row of matrix X:

  • Return the position of each element in the sorted vector.

  • If groupNum is specified, group the elements into groupNum groups and return the group number each element belongs to.

  • If ignoreNA =true, null values return NULL.

The result is a matrix with the same shape as X.

Parameters:
  • X (Constant) – A matrix.

  • ascending (Constant, optional) – Boolean value indicating whether the sorting is in ascending order. The default value is true (ascending).

  • groupNum (Constant, optional) – A positive integer indicating the number of groups to sort X into.

  • ignoreNA (Constant, optional) – A Boolean value indicating whether null values are ignored.

  • tiesMethod (Constant, optional) –

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

    • ’min’ : the smallest rank value of the tie values.

    • ’max’ : the largest rank value of the tie values.

    • ’average’ : the average of the rank values for all ties.

    • ’first’: Gives the first found tie value the lowest rank value, and continues with the following rank value for the next tie.

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

  • precision (Constant, optional) –

    An integer between [1, 15]. If the absolute difference between two values is no greater than 10^(-precision), the two values are considered to be equal.

    Note

    If parameter precision is specified, X must be numeric, and the tiesMethod cannot be specified as ‘first’.