Learn R Programming

nexus (version 0.6.0)

group_names: Grouping Metadata

Description

Retrieve the (reference) groups to which the observations belong.

Usage

group_names(object)

group_levels(object)

group_factor(object, ...)

group_rows(object)

group_n(object)

group_size(object)

group_indices(object)

# S4 method for ReferenceGroups group_levels(object)

# S4 method for ReferenceGroups group_names(object)

# S4 method for ReferenceGroups group_factor(object, exclude = NA)

# S4 method for ReferenceGroups group_indices(object)

# S4 method for ReferenceGroups group_rows(object)

# S4 method for ReferenceGroups group_n(object)

# S4 method for ReferenceGroups group_size(object)

Value

  • group_levels() returns a character vector giving the group names.

  • group_size() returns an integer vector giving the size of each group.

  • group_n() gives the total number of groups.

  • group_names() returns a character vector giving the name of the group that each observation belongs to.

  • group_factor() returns a factor vector giving the name of the group that each observation belongs to.

  • group_indices() returns an integer vector giving the group that each value belongs to.

  • group_rows() returns a list of integer vectors giving the observation that each group contains.

Arguments

object

A grouped R object.

...

Currently not used.

exclude

A character vector of values to be excluded when forming the set of levels.

Author

N. Frerebeau

See Also

Other grouping methods: group(), group_split(), group_subset(), is_assigned()

Examples

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

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

## Grouping metadata
group_levels(coda)

group_names(coda)

group_indices(coda)

group_rows(coda)

group_n(coda)

group_size(coda)

Run the code above in your browser using DataLab