match_labels {xnet}R Documentation

Reorder the label matrix

Description

Reorders the label matrix based on the labels of the kernel matrices. In case there are no labels, the original label matrix is returned, but with the labels in rows and cols as rownames and column names respectively.

Usage

match_labels(y, rows, cols = NULL)

Arguments

y

a matrix representing the label matrix.

rows

a character vector with the labels for the rows or a matrix with rownames that will be used as labels.

cols

a character vector with the labels for the cols or a matrix with colnames that will be used as labels. If NULL, rows will be used for both row and column labels.

Value

a matrix with the rows and columns reordered.

Examples

mat <- matrix(1:6, ncol = 2,
              dimnames = list(c("b", "a", "d"),
                              c("ca", "cb"))
             )

match_labels(mat, c("a","b", "d"), c("ca","cb"))

#Using matrices
data(drugtarget)
out <- match_labels(drugTargetInteraction, targetSim, drugSim)


[Package xnet version 0.1.11 Index]