o.to.m: o.to.m

View source: R/o.to.m.R

o.to.mR Documentation

o.to.m

Description

Transforms a vector into a matrix where it assumes that the vector values are the lower triangular of the matrix: 'm[lower.tri(m)] = o'. It includes 0 on the diagonal.

Usage

o.to.m(o, n = seq(sqrt(length(o) + 1) + 1))

Arguments

o

the vector containing the values for the lower triangular (required)

n

the names for the rows and columns of the matrix (optional)

Value

Returns a matrix where it assumes that 'm[lower.tri(m)] = o'.

Examples

m = matrix(1:9, nrow = 3, ncol = 3)
o = m[lower.tri(m)]
m_new = o.to.m(o)


callsync documentation built on May 29, 2024, 5:30 a.m.