vec | R Documentation |
Turn a multidimensional array into a (column) vector. Turn a (typically symmetric) matrix into a (column) vector of the lower triangular part. Or reverse these operations.
vec(x)
## S4 method for signature 'madness'
vec(x)
## S4 method for signature 'array'
vec(x)
vech(x, k = 0)
## S4 method for signature 'array'
vech(x, k = 0)
## S4 method for signature 'madness'
vech(x, k = 0)
ivech(x, k = 0, symmetric = FALSE)
## S4 method for signature 'ANY'
ivech(x, k = 0, symmetric = FALSE)
## S4 method for signature 'madness'
ivech(x, k = 0, symmetric = FALSE)
x |
a |
k |
the diagonal from which to subselect. |
symmetric |
logical whether to put the array on the antidiagonal
as well. Will throw an error if |
a madness
object or an array, of the vectorized array
or the subselected part. For the inverse operations, promotes to a
madness
of a matrix, or a matrix.
Steven E. Pav shabbychef@gmail.com
reshapes
, in particular tril
.
y <- matrix(rnorm(16),ncol=4)
sy <- y + t(y)
vy <- vec(sy)
vmy <- vec(madness(sy))
vhy <- vech(sy)
vmhy <- vech(madness(sy))
ivech(c(1,2,3))
ivech(c(1,2,3),-1)
ivech(c(1,2,3),-1,symmetric=TRUE)
ivech(c(1,2,3,4,5,6,7,8),1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.