makeTria | R Documentation |

Function is mainly used for `eatAnalysis::wtdHetcor`

function from the
`eatAnalysis`

package (https://github.com/beckerbenj/eatAnalysis/)
and the `eatModel::q3FromRes`

function in the `eatModel`

package: Triangular covariance/correlation matrices are tidily reshaped.

`makeTria (dfr)`

`dfr` |
A data frame consisting of a row name column and a square matrix. |

covariance/correlation matrices which are inherently symmetrical are often displayed
in a space-saving manner by only showing the upper or lower triangular part, omitting the
symmetrical counterpart. In R, covariance/correlation matrices tend to be displayed with their
upper and lower halves. Whereas `lower.tri`

and `upper.tri`

allows to replace upper or lower half with `NA`

s, the triangular shape could then be lost if the
covariance/correlation matrix was provided in a long format and reshaped afterwards. `makeTria`

sorts rows and colums appropriately to provide triangular shape if redundant entries are replaced by
NA. Please note that the functions expects row names in the first column of the input data.frame.

data frame.

```
dfr <- data.frame ( vars = paste0("var", 2:4), matrix(c(1:3, NA, NA, 5, 4,NA,6),
nrow=3, ncol=3, dimnames=list(NULL, paste0("var", 1:3))))
makeTria(dfr)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.