convert_pair_matrix: Convert paired cluster comparison values to a matrix

View source: R/util.R

convert_pair_matrixR Documentation

Convert paired cluster comparison values to a matrix

Description

Convert paired cluster comparison values to a matrix

Usage

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

Arguments

pair.num

a named numeric vector of values. Names correspond to 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 pair will specify 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


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 June 6, 2024, 5:31 a.m.