Description Usage Arguments Details Value Missing and non- values Ties Author(s) See Also

Gets the rank of each row (column) of a matrix.

1 2 |

`x` |
A |

`ties.method` |
A |

`preserveShape` |
A |

`...` |
Not used. |

The row ranks of `x`

are collected as *rows*
of the result matrix.

The column ranks of `x`

are collected as *rows*
if `preserveShape = FALSE`

, otherwise as *columns*.

The implementation is optimized for both speed and memory.
To avoid coercing to `double`

s (and hence memory allocation), there
is a unique implementation for `integer`

matrices.
It is more memory efficient to do
`colRanks(x, preserveShape=TRUE)`

than
`t(colRanks(x, preserveShape=FALSE))`

.

Currently, `colRanks(x)`

is just `rowRanks(t(x))`

.
Any `names`

of `x`

are ignored and absent in the result.

An `integer`

`matrix`

is returned.
The `rowRanks()`

function always returns an NxK `matrix`

,
where N (K) is the number of rows (columns) whose ranks are calculated.

The `colRanks()`

function returns an NxK `matrix`

,
if `preserveShape = TRUE`

, otherwise a KxN `matrix`

.

These are ranked as `NA`

, as with `na.last="keep"`

in the `rank`

() function.

When some values are equal ("ties"), argument `ties.method`

specifies what their ranks should be.
If `ties.method`

is `"max"`

, ties
are ranked as the maximum value.
If `ties.method`

is `"average"`

, ties are ranked
by their average.
If `ties.method`

is `"max"`

(`"min"`

), ties
are ranked as the maximum (minimum) value.
If `ties.method`

is `"average"`

, ties are ranked
by their average.
For further details, see `rank`

().

Hector Corrada Bravo and Harris Jaffee.
Peter Langfelder for adding 'ties.method' support.
Henrik Bengtsson adapted the original native implementation
of `rowRanks()`

from Robert Gentleman's `rowQ()`

in the Biobase package.

`rank`

().
For developers, see also Section 'Utility functions' in
'Writing R Extensions manual', particularly the native functions
`R_qsort_I()`

and `R_qsort_int_I()`

.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.