Learn R Programming

nexus (version 0.3.0)

groups: 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 CompositionMatrix is_assigned(object)

# S4 method for LogRatio is_assigned(object)

# S4 method for CompositionMatrix any_assigned(object)

# S4 method for LogRatio any_assigned(object)

# S4 method for CompositionMatrix groups(object)

# S4 method for LogRatio groups(object)

# S4 method for OutlierIndex groups(object)

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

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

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.

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.

Author

N. Frerebeau

Details

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

See Also

Other mutators: mutators, totals()

Examples

Run this code
## Data from Aitchison 1986
data("slides")
head(slides)

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

groups(coda)

Run the code above in your browser using DataLab