coordinates {coda.base} | R Documentation |
Calculate the coordinates of a composition with respect a given basis
coordinates(X, basis = "ilr", label = NULL, sparse_basis = FALSE)
X |
compositional dataset. Either a matrix, a data.frame or a vector |
basis |
basis used to calculate the coordinates. |
label |
name given to the coordinates |
sparse_basis |
Is the given matrix basis sparse? If TRUE calculation are carried taking into an account sparsity (default 'FALSE') |
coordinates
function calculates the coordinates of a compositiona w.r.t. a given basis. 'basis' parameter is
used to set the basis, it can be either a matrix defining the log-contrasts in columns or a string defining some well-known
log-contrast: 'alr' 'clr', 'ilr', 'pc', 'pb' and 'cdp', for the additive log-ratio, centered log-ratio, isometric log-ratio,
clr principal components, clr principal balances or default's CoDaPack balances respectively.
Coordinates of composition X
with respect the given basis
.
See functions ilr_basis
, alr_basis
,
clr_basis
, sbp_basis
to define different compositional basis.
See function composition
to obtain details on how to calculate
a compositions from given coordinates.
coordinates(c(1,2,3,4,5)) # basis is shown if 'coda.base.basis' option is set to TRUE options('coda.base.basis' = TRUE) coordinates(c(1,2,3,4,5)) # Setting sparse_basi to TRUE can improve performance if log-ratio basis is sparse. N = 100 K = 1000 X = matrix(exp(rnorm(N*K)), nrow=N, ncol=K) system.time(coordinates(X, alr_basis(K), sparse_basis = FALSE)) system.time(coordinates(X, alr_basis(K), sparse_basis = TRUE)) system.time(coordinates(X, 'alr'))