Stratify: Create a vector of stratifications

Description Usage Arguments Details Value Examples Author(s)

View source: R/Stratify.R

Description

Stratify takes an input vector and list of values used to designate the values returned in the strats vector.

Usage

1
Stratify(inVector = NULL, splits = NULL, Nnames = NULL, numeric = F)

Arguments

inVector

Input vector of values. May be numeric or character.

splits

List of values to use to stratify the input vector. May be character literals or numeric ranges.

Nnames

Vector the length of splits naming the strata.

numeric

A logical value, where if TRUE then findInterval will be used and stratum 0 will be assigned to values smaller than the first value in splits.

Details

Workflow

Stratify is intended to add levels for stratification before running getComps.

Any values not given in splits will be assigned to stratum 0. This function can be used to designate fleet or for stratification based on depth or INPFC area.

Value

Returns a vector the length of the input vector, with either numeric levels indicating the stratification of the input, or with Nnames assigning levels of the input vector.

Examples

Pdata$use_depth = Stratify( Pdata$DEPTH_AVG, splits=list(0, 50, 100, 250, 500), numeric=T)

Pdata$my_fleets = Stratify( Pdata$GEAR, splits=list("GFS", c("MDT","TB"), "TR", c("LGL","FTS")), Nnames=list("G1","G2","G3","G4") )

Author(s)

Andi Stephens


nwfsc-assess/PacFIN.Utilities documentation built on June 30, 2017, 8:49 a.m.