groups: Working With Groups

groupsR Documentation

Working With Groups

Description

Retrieves or defines the (reference) groups to which the observations belong.

Usage

groups(object)

groups(object) <- value

any_assigned(object)

is_assigned(object)

## S4 method for signature 'CompositionMatrix'
is_assigned(object)

## S4 method for signature 'LogRatio'
is_assigned(object)

## S4 method for signature 'CompositionMatrix'
any_assigned(object)

## S4 method for signature 'LogRatio'
any_assigned(object)

## S4 method for signature 'CompositionMatrix'
groups(object)

## S4 method for signature 'LogRatio'
groups(object)

## S4 method for signature 'OutlierIndex'
groups(object)

## S4 replacement method for signature 'CompositionMatrix,ANY'
groups(object) <- value

## S4 replacement method for signature 'CompositionMatrix,list'
groups(object) <- value

Arguments

object

An object from which to get or set groups.

value

A possible value for the groups of x (typically, a character vector). If value is a list, interaction(value) defines the grouping.

Details

Missing values (NA) or empty strings ("") can be used to specify that a sample does not belong to any group.

Value

  • groups() <- value returns an object of the same sort as x with the new group names assigned.

  • groups() returns a character vector giving the group names of x.

  • any_assigned() returns a logical scalar specifying whether or not x has groups.

  • is_assigned() returns a logical vector specifying whether or not an observation belongs to a group.

Author(s)

N. Frerebeau

See Also

Other mutators: mutators, totals()

Examples

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

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

groups(coda)

nexus documentation built on Sept. 11, 2024, 6:43 p.m.