Skip to contents

Group-based Subset

Usage

extract(object, ...)

# S4 method for class 'CompositionMatrix'
extract(object, name)

Arguments

object

A CompositionMatrix object.

...

Currently not used.

name

A character vector specifying the group of object to extract.

Value

A CompositionMatrix object.

See also

Other subsetting methods: bind, split(), subset()

Author

N. Frerebeau

Examples

## Data from Aitchison 1986
data("slides")
head(slides)
#>   analyst slide quartz microcline plagioclass biotite muscovite opaques
#> 1      A1     A   24.7       35.6        33.3     3.3       2.0     0.6
#> 2      A1     B   26.8       35.7        32.6     3.5       0.4     0.6
#> 3      A1     C   28.0       34.2        32.1     3.4       1.1     0.7
#> 4      A1     D   27.8       35.0        31.5     3.3       1.0     0.9
#> 5      A1     E   26.6       34.5        33.6     3.0       1.4     0.6
#> 6      A2     A   27.3       35.5        32.1     2.5       1.5     0.8
#>   nonopaques
#> 1        0.6
#> 2        0.4
#> 3        0.4
#> 4        0.5
#> 5        0.3
#> 6        0.3

## Coerce to compositional data
coda <- as_composition(slides, groups = 2)

groups(coda)
#> Error in x$membership: $ operator is invalid for atomic vectors