stratify: Stratify gtypes

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/stratify.R

Description

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

Usage

1
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

1
2
3
4
5
data(msats.g)
msats.g

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

strataG documentation built on Feb. 28, 2020, 9:07 a.m.