Learn R Programming

strataG (version 1.0.3)

stratify: 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.
drop
remove samples not assigned to a stratum? (those assigned NA in stratification scheme)

Value

  • A new gtypes object with an updated strata slot.

Examples

Run this code
data(dolph.msats)
data(dolph.strata)
strata.schemes <- dolph.strata[, c("broad", "fine")]
rownames(strata.schemes) <- dolph.strata$id
msats <- new("gtypes", gen.data = dolph.msats[, -1], ploidy = 2,
             ind.names = dolph.msats[, 1], schemes = strata.schemes)
msats <- stratify(msats, "fine")
msats

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

Run the code above in your browser using DataLab