stratify: Stratify gtypes

View source: R/stratify.R

stratifyR Documentation

Stratify gtypes

Description

Choose a new stratification scheme from the schemes slot in a gtypes object.

Usage

stratify(g, scheme = NULL, drop = TRUE)

Arguments

g

a gtypes object.

scheme

either the column name of a stratification scheme stored in the data.frame of the schemes slot of g, or a vector or factor identifying which stratum each sample belongs to. If NULL, all individuals are assigned to a single stratum named "Default".

drop

remove samples not assigned to a stratum? (those assigned NA in stratification scheme)

Value

A new gtypes object with an updated strata slot.

Note

If scheme is a vector or factor and has names, then the they will be used to match with getIndNames of g. Otherwise scheme should be the same length as the number of samples in g or values in scheme will be recycled as necessary.

Author(s)

Eric Archer eric.archer@noaa.gov

See Also

getSchemes

Examples

data(msats.g)
msats.g

broad.msats <- stratify(msats.g, "broad")
broad.msats


EricArcher/strataG documentation built on Feb. 12, 2023, 4:11 a.m.