# Tri2M

From MCMCglmm v2.29
by Jarrod Hadfield

##### Lower/Upper Triangle Elements of a Matrix

Lower/Upper triangle elements of a matrix or forms a matrix from a vector of lower/upper triangle elements

- Keywords
- manip

##### Usage

`Tri2M(x, lower.tri = TRUE, reverse = TRUE, diag = TRUE)`

##### Arguments

- x
Matrix or vector

- lower.tri
If

`x`

is a matrix then the lower triangle (`TRUE`

) or upper triangle`FALSE`

elements (including diagonal elements) are returned. If`x`

is a vector a matrix is formed under the assumption that`x`

are the lower triangle (`TRUE`

) or upper triangle (`FALSE`

) elements.- reverse
logical: if

`TRUE`

a symmetric matrix is formed, if`FALSE`

the remaining triangle is left as zeros.- diag
logical: if

`TRUE`

diagonal elements are included.

##### Value

numeric or matrix

##### Examples

```
# NOT RUN {
M<-rIW(diag(3), 10)
x<-Tri2M(M)
x
Tri2M(x, reverse=TRUE)
Tri2M(x, reverse=FALSE)
# }
```

*Documentation reproduced from package MCMCglmm, version 2.29, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.