Define or remove the (reference) groups to which the observations belong.
methods
group(object,...)ungroup(object,...)## S4 method for signature 'CompositionMatrix'group(object, by, verbose = getOption("nexus.verbose"),...)## S4 method for signature 'GroupedComposition'group(object, by, add =FALSE, verbose = getOption("nexus.verbose"),...)## S4 method for signature 'GroupedComposition'ungroup(object)## S4 method for signature 'GroupedLR'ungroup(object)## S4 method for signature 'GroupedCLR'ungroup(object)## S4 method for signature 'GroupedALR'ungroup(object)## S4 method for signature 'GroupedILR'ungroup(object)## S4 method for signature 'GroupedPLR'ungroup(object)
Arguments
object: An object (typically, a CompositionMatrix object).
...: Further parameters to be passed to internal methods.
by: A possible value for the groups of object (typically, a character vector). If value is a list, interaction(by) defines the grouping.
verbose: A logical scalar: should report extra information on progress?
add: A logical scalar. If TRUE, add to existing groups.
Returns
group() returns a grouped object of the same sort as object.
ungroup() returns an ungrouped object of the same sort as object.
Details
Missing values (NA) can be used to specify that a sample does not belong to any group.
Examples
## Data from Aitchison 1986data("slides")## Coerce to compositional datacoda <- as_composition(slides, groups =2)## Grouping metadatagroup_levels(coda)group_names(coda)group_indices(coda)group_rows(coda)group_length(coda)group_size(coda)
See Also
Other grouping methods: group_metadata, group_split(), group_subset()