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: ifTRUE a symmetric matrix is formed, if
FALSE the remaining triangle is left as zeros.
M<-rIW(diag(3), 10)
x<-Tri2M(M)
x
Tri2M(x, reverse=TRUE)
Tri2M(x, reverse=FALSE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MCMCglmm)
Loading required package: Matrix
Loading required package: coda
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MCMCglmm/Tri2M.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Tri2M
> ### Title: Lower/Upper Triangle Elements of a Matrix
> ### Aliases: Tri2M
> ### Keywords: manip
>
> ### ** Examples
>
> M<-rIW(diag(3), 10)
> x<-Tri2M(M)
> x
[1] 1.40472169 -0.05231208 0.08563669 1.52951420 -0.16925075 0.54069877
> Tri2M(x, reverse=TRUE)
[,1] [,2] [,3]
[1,] 1.40472169 -0.05231208 0.08563669
[2,] -0.05231208 1.52951420 -0.16925075
[3,] 0.08563669 -0.16925075 0.54069877
> Tri2M(x, reverse=FALSE)
[,1] [,2] [,3]
[1,] 1.40472169 0.0000000 0.0000000
[2,] -0.05231208 1.5295142 0.0000000
[3,] 0.08563669 -0.1692507 0.5406988
>
>
>
>
>
> dev.off()
null device
1
>