Splits the data into subsets and computes compositional mean for each.
Usage
condense(x, ...)
# S4 method for class 'CompositionMatrix'
condense(x, by = groups(x), ...)
Arguments
- x
A
CompositionMatrix
object.- ...
Further arguments to be passed to
mean()
.- by
A
vector
or a list of grouping elements, each as long as the variables inx
. The elements are coerced to factors before use (in the sense thatinteraction(by)
defines the grouping).
Value
A CompositionMatrix
object.
See also
Other statistics:
aggregate()
,
covariance()
,
dist
,
mahalanobis()
,
margin()
,
mean()
,
pip()
,
quantile()
,
scale()
,
variance()
,
variance_total()
,
variation()
Examples
## Data from Aitchison 1986
data("slides")
## Coerce to a compositional matrix
coda <- as_composition(slides, groups = 2)
## Compositional mean by group
condense(coda)
#> <CompositionMatrix: 5 x 7>
#> quartz microcline plagioclass biotite muscovite opaques
#> A 0.2591344 0.3553997 0.3335045 0.02654833 0.013683701 0.007173544
#> B 0.2703079 0.3526640 0.3239803 0.03482515 0.008977167 0.006667495
#> C 0.2772923 0.3535327 0.3149545 0.03107089 0.011128347 0.007732587
#> D 0.2757090 0.3548635 0.3138702 0.03298438 0.010338266 0.009093408
#> E 0.2794701 0.3474061 0.3231178 0.02962410 0.010892785 0.006494703
#> nonopaques
#> A 0.004555830
#> B 0.002578014
#> C 0.004288649
#> D 0.003141288
#> E 0.002994409