create_groups: Create groupings

View source: R/create_groups.R

create_groupsR Documentation

Create groupings

Description

Assign species to a priori groupings.

Usage

create_groups(dat.obj, species.groups = NULL, abbrev = FALSE)

Arguments

dat.obj

Input dataset. Must be an object of class brsdata, as returned by read_data or simulate_data.

species.groups

List indicating which species should be grouped. These can be given using any combination of scientific name, common name, or unique identifier, as defined in species_brs. If species.groups is given as a named list, the names of each list element will be used as group names. If species.groups is unnamed, the function will combine species codes from species_brs to generate appropriate group names.

abbrev

Logical. If TRUE, group names will be abbreviated. This is useful for plotting and data summaries.

Value

A list object of class brsdata.grp.

Author(s)

Phil J. Bouchet

See Also

undo_groups summary.brsdata

Examples

## Not run: 
library(espresso)

# Import the example data, excluding Risso's dolphins and minke whales
mydat <- read_data(file = NULL, exclude.species = c("gg", "ba")) 
summary(mydat)

# Group all beaked whales together
mydat.grouped <- create_groups(mydat, 
                  species.groups = list(c("Md", "Cuvier's beaked whale", 
                                        "Hyperoodon ampullatus")))

Examine the resulting grouping
summary(mydat.grouped)

## End(Not run)

pjbouchet/espresso documentation built on July 27, 2024, 12:31 p.m.