Description Usage Arguments Details Value Author(s) References See Also Examples
Given a symmetric matrix, half.matrix
converts the corresponding lower (upper) triangular
matrix to a vector in row- (column-) major order. The vector
is named using the convention row.column
(for the lower interpretation)
and is classed as halfmatrix
. The function as.matrix.halfmatrix
converts a halfmatrix-like vector to a symmetric matrix. The halfmatrix
method for generic offdiag
selects just the off-diagonal elements from
the (named) vector of the corresponding class.
1 2 3 4 5 6 7 8 9 10 11 12 |
x |
symmetric matrix (half) or halfmatrix equivalent (as.matrix) |
... |
extra arguments, ignored |
It is an error if x
is a matrix but not symmetric. If x
is a
vector of appropriate length it can be converted to a symmetric matrix by specifying the method
explicitly, even if x
is not classed as halfmatrix:
as.matrix.halfmatrix(x)
. x
can also be converted to halfmatrix explicitly,
in which case as.matrix(x))
suffices.
vector with as many elements as a triangular matrix corresponding to x
(except as.matrix
returns matrix)
Tim Bergsma
http://metrumrg.googlecode.com
ord.matrix
isSymmetric.matrix
1 2 3 4 5 6 | half(diag(3))
as.matrix(half(diag(3)))
as.matrix.halfmatrix(1:15)
as.matrix(as.halfmatrix(1:15))
as.halfmatrix(1:10)
offdiag(as.halfmatrix(1:10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.