Skip to contents

Marginal Compositions

Usage

margin(x, ...)

# S4 method for CompositionMatrix
margin(x, parts = c(1, 2), name = "*")

Arguments

x

A CompositionMatrix object.

...

Currently not used.

parts

An integer or a character vector specifying the columns to be selected.

name

A character string giving the name of the amalgamation column.

Value

A CompositionMatrix object.

See also

Other statistics: aggregate(), condense(), covariance(), dist, mahalanobis(), mean(), metric_var(), pip(), quantile(), scale(), variation()

Author

N. Frerebeau

Examples

## Data from Aitchison 1986
data("hongite")

## Coerce to compositional data
coda <- as_composition(hongite)

## Marginal compositions
mar <- margin(coda, parts = c("B", "D"))
head(mar)
#> <CompositionMatrix: 6 x 3>
#>            B         D         *
#> H1 0.6328342 0.1277646 0.2394011
#> H2 0.4837434 0.1869933 0.3292633
#> H3 0.2163720 0.2258829 0.5577451
#> H4 0.4936486 0.2094895 0.2968618
#> H5 0.6888621 0.1384919 0.1726460
#> H6 0.5360281 0.2557386 0.2082334