get_broad_stock_rate: Get Broad Stock Rate This function is a special case of...

View source: R/get_broad_stock_rate.R

get_broad_stock_rateR Documentation

Get Broad Stock Rate This function is a special case of run_discard. When sotck is used as a startification variable, it is not starightforward to get a broad stock rate, with a CV. This function simply subsets a larger dataset by stock component before running run_discard. The advantage of having this as a function is it may easily be run in a loop.

Description

Get Broad Stock Rate This function is a special case of run_discard. When sotck is used as a startification variable, it is not starightforward to get a broad stock rate, with a CV. This function simply subsets a larger dataset by stock component before running run_discard. The advantage of having this as a function is it may easily be run in a loop.

Usage

get_broad_stock_rate(
  bdat,
  ddat_focal_sp,
  ddat_focal,
  species_itis,
  stratvars,
  stock = "GOM"
)

Arguments

bdat

table of observed trips that can include (and should include) multiple years

ddat_focal_sp

table of observed trips for discard year

ddat_focal

matched table of observed and commerical trips

species_itis

species of interest using SPECIES_ITIS code

stratvars

stratification variables desired: should only be SPECIES_STOCK; ususally the first of a strinf of stratification variables

stock

specific stock (name) to run

Value

a list of: 1) Species stock 2) discaRd rate 3) CV

Examples

stratvars_scalgf = c("SPECIES_STOCK"
, "CAMS_GEAR_GROUP" 
, "MESHGROUP"     
, "TRIPCATEGORY" 
, "ACCESSAREA"  
, "SCALLOP_AREA"
)

BROAD_STOCK_RATE_TABLE = list()
kk = 1
ustocks = bdat_scal$SPECIES_STOCK %>% unique()
for(k in ustocks){
BROAD_STOCK_RATE_TABLE[[kk]] = get_broad_stock_rate(bdat = bdat_scal
																										, ddat_focal_sp = ddat_focal_scal
																										, ddat_focal = ddat_focal
																										, species_itis = species_itis
																										, stratvars = stratvars_scalgf[1]																	
																										, stock = k 
)
kk = kk+1
}
BROAD_STOCK_RATE_TABLE = do.call(rbind, BROAD_STOCK_RATE_TABLE)
rm(kk, k)


noaa-garfo/discaRd documentation built on April 17, 2025, 10:32 p.m.