match_labels: Reorder the label matrix

Description Usage Arguments Value Examples

View source: R/match_labels.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

xnet documentation built on Feb. 4, 2020, 9:10 a.m.