An S4 class to represent compositional data.
class
is_composition(object)
Arguments
object: A CompositionMatrix object.
Slots
totals: A numeric vector to store the absolute row sums (before the closure of the compositions).
Note
This class inherits from NumericMatrix.
Coerce
In the code snippets below, x is a CompositionMatrix object.
as.data.frame(x): Coerces to a data.frame.
Subset
In the code snippets below, x is a CompositionMatrix object.
x[i, j]: Extract parts of a matrix (see [).
Examples
## Data from Aitchison 1986data("hongite")## Coerce to compositional datacoda <- as_composition(hongite)## codaccessdim(coda)# Get the matrix dimensionsrow(coda)# Get the row indexescol(coda, as.factor =TRUE)# Get the column indexesnrow(coda)# Get the number of rowsncol(coda)# Get the number of columnsdimnames(coda)# Get the dimension namesrownames(coda)<- LETTERS[1:25]# Set the row namesrownames(coda)# Get the rownamescolnames(coda)<- letters[21:25]# Set the column namescolnames(coda)# Get the column names
See Also
as_composition()
Other classes: GroupedComposition-class, GroupedLogRatio-class, LogRatio-class, NumericMatrix-class, OutlierIndex-class, ReferenceGroups-class