Learn R Programming

qgraph (version 1.10.1)

mat2vec: Weights matrix to vector

Description

Converts a weights matrix to a vector of weights. If the matrix is symmetric only upper triangle values are returned in the vector.

Usage

mat2vec(x, diag = FALSE, tol = 1e-10)

Value

A numeric vector of edge weights. If the matrix is symmetric, the upper triangle values are returned; if it is not symmetric, the upper and lower triangle values are returned. If diag = TRUE, all elements of the matrix are returned.

Arguments

x

A weights matrix

diag

Logical: should diagonal values be included?

tol

Tolerance used when testing whether the matrix is symmetric

Author

Sacha Epskamp <mail@sachaepskamp.com>