Data from the PacFIN gear table is used to create a column in Pdata called geargroup, where Pdata[["GRID"]] is recoded to geargroup` according to the gear group listed in the table.

getGearGroup(Pdata, spp = NULL, verbose = TRUE)

Arguments

Pdata

A data frame, typically one extracted from PacFIN but for this function just one column is needed, GRID. If a newer data pull is used, the function will change PACFIN_GEAR_CODE to GRID for you.

spp

A character string giving the species name to ensure that the methods are species specific. Leave NULL if generic methods work for your species. Currently, sablefish is the only species with species-specific code.

verbose

A logical specifying if output should be written to the screen or not. Good for testing and exploring your data but can be turned off when output indicates information that you already know. The printing of output to the screen does not affect any of the returned objects. The default is to always print to the screen, i.e., verbose = TRUE.

Value

A modified data frame where an additional column labeled geargroup is added to Pdata. No original columns are modified in the process.

Details

For some species the recoding is more intense. For example, sablefish GROUPS are recoded into just three gears, hook and line (HKL), pot (POT), and trawl (TWL). This is done internally to maintain consistency across assessment authors. Other species can easily be added to this function. If a species name is not passed then no additional recoding is performed compared to the matching available in the table pulled from online.

See also

Author

Andi Stephens, Kelli F. Johnson, Chantel R. Wetzel

Examples

gears <- c("PRT", "FPT", "TWL", "MDP")
X <- getGearGroup(data.frame(GRID = gears), verbose = TRUE)
#>  Gear groupings reflect those in the table at
#> https://pacfin.psmfc.org/pacfin_pub/data_rpts_pub/code_lists/gr.txt
#>  `GRID` was used to create `geargroup`
#>  geargroup includes: MDP (1), POT (1), and TWL (2)
table(X[["geargroup"]])
#> 
#> MDP POT TWL 
#>   1   1   2