strata.fn | R Documentation |
Function to return a dataframe with only specified values, categorized takes in the full data.frame returns a list with: dat: the subsetted dataframe with columns and levels for each variable. All observations not meeting criteria are removed if subset=T numVessels: The number of unique vessels in each strata. stratObs: the number of observations in each stratum summaryUnique: unique observations over the subsetted dataframe for the specified columns
strata.fn(
dat,
colnms = NULL,
colnms.new = paste0(colnms, "new"),
colLevs = NULL,
stratNms = NULL,
yrColNm = NULL,
yrColNm.new = paste0(yrColNm, "new"),
yrs = NULL,
subset = T,
verbose = T
)
dat |
the dataframe of observations |
colnms |
: the names of the columns to subset over (i.e., c("GEAR_TYPE","COMMON_NAME") ). Do not include year columns here, that is kept separate. If numeric, it refers to the column number |
colLevs |
A list of the levels to cut at, or select from each column. The list elements must be in the same order as colnms If numeric, then it will cut. If character, it will select that specific value. Year is always selected for a particular year |
yrColNm |
the name of the column for year (if there is one). If numeric, it is the column number |
yrs |
the years. NOT entered as in version 2 functions. MUST use the concatenate function. For example c(2003:2005,2007,2008:2010,2012) the reason I did not use the '...' is because it gets confused when not including multiple arguments. For example, if using ... and not entering colnms because you want to use default, it will think that one of the years is colnms |
subset |
whether or not to return a subset of the data |
verbose |
whether to output messages to screen. These are also returned in the data.frame |
stratNms: |
Optional names for levels in each strata. This must be a list with an element for each column. Within each element is a vector of names for each stratum in the same order as colLevs |
summaryNames |
names of column to provide a summary over |
vesselColName |
the column that defines vessels |
Allan Hicks and Chantel Wetzel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.