Computes cartesian coordinates.
Usage
coordinates_cartesian(x, y, z, ...)
# S4 method for numeric,numeric
coordinates_cartesian(x, y)
# S4 method for ANY,missing
coordinates_cartesian(x)
Arguments
- x, y
A
numeric
vector giving the x and y ternary coordinates of a set of points. Ify
is missing, an attempt is made to interpretx
in a suitable way (seegrDevices::xy.coords()
).- ...
Currently not used.
Value
A list
.
See also
Other coordinates:
coordinates_ternary()
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
#>
## 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
#>