Calculate a ranked matrix
Arguments
- object
Object.
- MARGIN
integer(1)
. Direction to apply the function. 1 indicates rows, 2 indicates columns.- method
character(1)
. Rank the values inincreasing
,decreasing
, orbidirectional
order.- tiesMethod
character(1)
. How ties should be treated. Seerank()
for details.- ...
Additional arguments.
Details
Ties are resolved automatically by calculating the average.
See the ties.method
parameter in rank()
for details.
See also
Not to be confused with
Matrix::rankMatrix()
.
Examples
data(matrix_lfc, package = "AcidTest")
object <- matrix_lfc
## Increasing (negative to positive).
rankedMatrix(object, method = "increasing")
#> contrast01 contrast02 contrast03 contrast04
#> gene01 1.0 7.0 6.0 8.0
#> gene02 2.0 4.5 8.0 6.0
#> gene03 3.0 2.0 2.0 1.0
#> gene04 4.5 1.0 4.5 7.0
#> gene05 4.5 6.0 3.0 4.5
#> gene06 6.0 4.5 4.5 2.0
#> gene07 7.0 8.0 7.0 4.5
#> gene08 8.0 3.0 1.0 3.0
## Decreasing (positive to negative).
rankedMatrix(object, method = "decreasing")
#> contrast01 contrast02 contrast03 contrast04
#> gene01 8.0 2.0 3.0 1.0
#> gene02 7.0 4.5 1.0 3.0
#> gene03 6.0 7.0 7.0 8.0
#> gene04 4.5 8.0 4.5 2.0
#> gene05 4.5 3.0 6.0 4.5
#> gene06 3.0 4.5 4.5 7.0
#> gene07 2.0 1.0 2.0 4.5
#> gene08 1.0 6.0 8.0 6.0
## Bidirectional.
rankedMatrix(object, method = "bidirectional")
#> contrast01 contrast02 contrast03 contrast04
#> gene01 -2.0 4.0 3.0 5.0
#> gene02 -1.0 1.5 5.0 3.0
#> gene03 0.0 -1.0 -1.0 -2.0
#> gene04 1.5 -2.0 1.5 4.0
#> gene05 1.5 3.0 0.0 1.5
#> gene06 3.0 1.5 1.5 -1.0
#> gene07 4.0 5.0 4.0 1.5
#> gene08 5.0 0.0 -2.0 0.0