Skip to contents

Group-based Subset

Usage

group_extract(object, ...)

# S4 method for class 'GroupedComposition'
group_extract(object, which)

Arguments

object

A GroupedComposition object.

...

Currently not used.

which

A character vector specifying the groups of object to extract.

Value

A CompositionMatrix object.

See also

Other grouping methods: group(), group_metadata, group_split()

Author

N. Frerebeau

Examples

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

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

## Grouping metadata
group_levels(coda)
#> [1] "A" "B" "C" "D" "E"

group_names(coda)
#>  [1] "A" "B" "C" "D" "E" "A" "B" "C" "D" "E" "A" "B" "C" "D" "E" "A" "B" "C" "D"
#> [20] "E" "A" "B" "C" "D" "E"

group_indices(coda)
#>  [1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

group_rows(coda)
#> $A
#> [1]  1  6 11 16 21
#> 
#> $B
#> [1]  2  7 12 17 22
#> 
#> $C
#> [1]  3  8 13 18 23
#> 
#> $D
#> [1]  4  9 14 19 24
#> 
#> $E
#> [1]  5 10 15 20 25
#> 

group_length(coda)
#> [1] 5

group_size(coda)
#> A B C D E 
#> 5 5 5 5 5