lower.tri.vector: Split Matrix by Clusters and Return Lower Triangular Parts as...

View source: R/lower.tri.vector.R

lower.tri.vectorR Documentation

Split Matrix by Clusters and Return Lower Triangular Parts as Vector

Description

Split a matrix into block diagonal sub matrices according to clusters and combine the lower triangular parts into a vector

Usage

lower.tri.vector(x, cluster = rep(1, nrow(x)), diag = FALSE)

Arguments

x

a square matrix

cluster

numeric or factor. Is used to identify the sub-matrices of x from which the lower triangular parts are extracted. Defaults to the full matrix.

diag

logical. Should the diagonal be included?

Value

Returns a numeric vector containing the elements of the lower triangular sub matrices.

Author(s)

Claus Ekstrom claus@ekstroem.dk

See Also

lower.tri

Examples


m <- matrix(1:64, ncol=8)
cluster <- c(1, 1, 1, 1, 2, 2, 3, 3)
lower.tri.vector(m, cluster)


MESS documentation built on Aug. 21, 2023, 1:05 a.m.

Related to lower.tri.vector in MESS...