convert_pair_matrix: Convert paired cluster comparison values to a matrix

Description Usage Arguments Value Examples

View source: R/util.R

Description

Convert paired cluster comparison values to a matrix

Usage

1
convert_pair_matrix(pair.num, l = NULL, directed = FALSE)

Arguments

pair.num

a vector of values with names of compared elements separted by "_", e.g. "c1_c2", "c23_c59"

l

labels for columns. Default is NULL, which will compute them from names(pair.num)

directed

If FALSE (default), the first value in each split will be used as columns, with the second as rows. If TRUE, first values will be rows, and second will be columns.

Value

a matrix containing values from pair.num, and named for each element separated by "_" in names(pair.num)

Examples

1
2
3
4
5
6
7
8
9
pair_values <- seq(1,27,3)
names(pair_values) <- paste(rep(letters[1:3], each = 3), rep(letters[1:3], 3), sep = "_")
pair_values

pair_matrix <- convert_pair_matrix(pair_values, directed = FALSE)
pair_matrix

pair_matrix <- convert_pair_matrix(pair_values, directed = TRUE)
pair_matrix

AllenInstitute/scrattch.hicat documentation built on May 5, 2019, 1:32 a.m.