Calculate a ranked matrix

rankedMatrix(
  object,
  MARGIN = 2L,
  method = c("increasing", "decreasing", "bidirectional")
)

Arguments

object

Object.

MARGIN

a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where X has named dimnames, it can be a character vector selecting dimension names.

method

character(1). Rank the values in increasing, decreasing, or bidirectional order.

Value

matrix.

Note

Ties are resolved automatically by calculating the average. See the ties.method parameter in rank() for details.

Updated 2019-08-11.

See also

Examples

data(matrix_lfc, package = "acidtest") lfc <- matrix_lfc ## Increasing (negative to positive) rankedMatrix(lfc, 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(lfc, 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(lfc, 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