# toTernaryQuaternary: Transform Compositional Data for a Simplex In DirichletReg: Dirichlet Regression in R

## Description

These functions transform a matrix with three or four components to fit into a two- or three-dimensional simplex (triangle or tetrahedron).

## Usage

 ```1 2 3 4 5 6 7``` ```toSimplex(x) toTernary(abc) toTernaryVectors(c1, c2, c3) toQuaternary(abcd) toQuaternaryVectors(c1, c2, c3, c4) ```

## Arguments

 `x` a matrix-like object with 3 or 4 columns. `abc` a matrix-like object with 3 columns. `abcd` a matrix-like object with 4 columns. `c1` a numeric vector with values of the first component. `c2` a numeric vector with values of the second component. `c3` a numeric vector with values of the third component. `c4` a numeric vector with values of the fourth component.

## Details

Most of these functions are only used internally, but sometimes it might be useful to plot “custom” ternary or quaternary graphics.

Note that, apart from `toSimplex()`, functions do not have any checks, so it is advisable to use this function if elements are added to plots or own graphics are created.

## Value

The function returns a `matrix` object with coordinates in two or three dimensions

## Note

In prior versions (up to 0.5-0), an unexported function `coord.trafo()` was used internally and could also be accessed via `DirichletReg:::coord.trafo()`.

If you have used this in your code, you will get a message that the function is now deprecated and will become defunct in the future. Use `toSimplex()` instead.

Marco J. Maier

## Examples

 ```1 2``` ```# create a DirichletRegData object from the Arctic Lake data "to be added" ```

DirichletReg documentation built on May 29, 2017, 7:09 p.m.