Computes ternary coordinates.
Usage
coordinates_ternary(x, y, z, ...)
# S4 method for class 'numeric,numeric,numeric'
coordinates_ternary(
x,
y,
z,
center = FALSE,
scale = FALSE,
missing = getOption("isopleuros.missing")
)
# S4 method for class 'ANY,missing,missing'
coordinates_ternary(
x,
xlab = NULL,
ylab = NULL,
zlab = NULL,
center = FALSE,
scale = FALSE,
missing = getOption("isopleuros.missing")
)
Arguments
- x, y, z
A
numeric
vector giving the x, y and z cartesian coordinates of a set of points. Ify
andz
are missing, an attempt is made to interpretx
in a suitable way (seegrDevices::xyz.coords()
).- ...
Currently not used.
- center
- scale
A
logical
scalar or a length-onenumeric
vector giving a scaling factor.- missing
A
logical
scalar: should missing values be replaced with zeros before the computation proceeds? IfFALSE
(the default), incomplete cases are removed.- xlab, ylab, zlab
A
character
string specifying the names for the x, y and z variables to be extracted.
Value
A list
with the components:
x | A numeric vector of x coordinates. |
y | A numeric vector of y coordinates. |
center | A numeric vector giving the center. |
scale | A numeric vector giving the scale factor. |
See also
Other coordinates:
coordinates_cartesian()
Examples
## Compositional data
coda <- data.frame(
x = c(1, 0, 0, 1/3),
y = c(0, 1, 0, 1/3),
z = c(0, 0, 1, 1/3)
)
## Ternary coordinates
(tern <- coordinates_ternary(coda))
#> $x
#> [1] 0.0 1.0 0.5 0.5
#>
#> $y
#> [1] 0.0000000 0.0000000 0.8660254 0.2886751
#>
#> $center
#> [1] 1 1 1
#>
#> $scale
#> [1] 1
#>
## Cartesian coordinates
(cart <- coordinates_cartesian(tern))
#> $x
#> [1] 1.0000000 0.0000000 0.0000000 0.3333333
#>
#> $y
#> [1] 0.0000000 1.0000000 0.0000000 0.3333333
#>
#> $z
#> [1] 0.0000000 0.0000000 1.0000000 0.3333333
#>