expand_matrix: Expand Matrix

View source: R/utilities.R

expand_matrixR Documentation

Expand Matrix

Description

Expand Matrix

Usage

expand_matrix(A, label = NULL, loops = FALSE, normalize = FALSE)

Arguments

A

A square matrix

label

Duplicated labels to expand the matrix

loops

Whether the loops are retained or not

normalize

Whether to normalize the matrix considering the fractional counting per group

Value

Return an expanded matrix

Author(s)

Alejandro Espinosa-Rada

Examples

A <- matrix(c(
  0, 1, 1,
  0, 0, 1,
  1, 0, 0
), byrow = TRUE, ncol = 3, nrow = 3)
rownames(A) <- letters[1:NROW(A)]
colnames(A) <- rownames(A)
label <- sort(rep(rownames(A), 2))
expand_matrix(A, label, loops = FALSE, normalize = TRUE)

anespinosa/netmem documentation built on April 5, 2025, 5:02 p.m.