| Title: | FRAM LUTs and mappings |
|---|---|
| Description: | Look-up tables and convenience functions for working with FRAM tables. |
| Authors: | Ty Garber [cre, aut], Collin Edwards [aut] (ORCID: <https://orcid.org/0000-0002-4937-5159>) |
| Maintainer: | Ty Garber <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-07-09 16:47:39 UTC |
| Source: | https://github.com/FRAMverse/framrosetta |
This table is based on Chinook stock tables from pre-season 2024. Additional stock may be added in the future (splitting out stock aggregates). The 'bk_lookupfun_chin()' function accommodates this.
bk_lookup_chinbk_lookup_chin
A data frame with 116 rows and 3 columns:
Stock name
Stock ID in the BackwardsFRAM table
Stock ID anywhere else in FRAM and TAMM
2024 Pre-Season Chinook DB.mdb
At present the FRAM databases use a differents stock_id numbering system in the BackwardsFRAM table than everywhere else. The dataframe 'bk_lookup_chin' provides a lookup table based on the stocks used in Preseason 2024. However, we are working to modify FRAM to support splitting Chinook stock aggregates, which will lead to increased numbers of StockIDs. 'bk_lookupfun_chin' provides an appropruate lookup table based on the 'max_stock' argument, either returning ‘bk_lookup_chin' (if max_stock is not provided or doesn’t exceed the stocks in 'bk_lookup_chin') or extending the dataframe with new stock ids based on the numbering conventions of the bk_stock_id.
bk_lookupfun_chin(max_stock = NA)bk_lookupfun_chin(max_stock = NA)
max_stock |
Positive integer representing the largest *Normal* stock id (stock ids outside of the BackwardsFram table). As of Preseason 2024, there are 78 stocks; splitting stocks might increase this (e.g. 80, 82, 84). Defaults to NA. |
Tibble of lookup table. '$stock_name_bk' gives numan-readable stock names; '$bk_stock_id' gives the "StockID" used in backwards FRAM; '$stock_id' gives the StockID used everywhere else. NAs in '$stock_id' correspond to "totalled" stocks, which are used in backwards FRAM and nowhere else.
temp = bk_lookupfun_chin(80) tail(temp)temp = bk_lookupfun_chin(80) tail(temp)
Mapping of fishery_id to fishery name for Chinook salmon, taken from the 'Fishery' table of the Chinook FRAM database.
fishery_chinook_framfishery_chinook_fram
A data frame with 74 rows and 5 columns:
Species name
Chinook fishery id number in FRAM
Chinook fishery name in FRAM
consistent and more human readable version of 'fishery_name'
2024 Pre-Season Chinook DB.mdb
Mapping of fishery_id to fishery name for Coho salmon, taken from the 'Fishery' table of the Coho FRAM database.
fishery_coho_framfishery_coho_fram
A data frame with 198 rows and 5 columns:
Species name
Coho fishery id number in FRAM
Coho fishery name in FRAM
consistent and more human readable version of 'fishery_name'
2024NOF_CohoFRAMdatabase_distribution.mdb
Mapping of FRAM fishery_id to PSC fishery ID and name for Coho salmon, based on the AnnualReport R package.
fishery_coho_pscfishery_coho_psc
A data frame with 197 rows and 5 columns:
Species name
Fishery ID in FRAM
Corresponding ID for the psc fishery
Name of PSC fishery ID for the psc fishery
https://github.com/PSC-CoTC/AnnualReport
Search through fishery and stock lookup tables.
fishery_search(pattern, species) stock_search(pattern, species)fishery_search(pattern, species) stock_search(pattern, species)
pattern |
Character string of pattern to search for, case insensitive. If numeric instead, function will return the row with the corresponding stock or fishery ID. |
species |
"CHINOOK" or "COHO" (or lowercase permutations) |
fishery_search("kmz", "COHO") fishery_search(50, "COHO") stock_search("nooksack", "CHINOOK") stock_search(21, "CHINOOK")fishery_search("kmz", "COHO") fishery_search(50, "COHO") stock_search("nooksack", "CHINOOK") stock_search(21, "CHINOOK")
Streamlined version of using 'left_join', 'rename', and 'relocate' to add human-readable text to a dataframe with fishery_id or similar columns. Automatically detects species and 'fishery_id' column; user can specify species or alternative name for fishery_id column if needed.
label_fisheries(.data, species = NULL, fisheries_col = "fishery_id")label_fisheries(.data, species = NULL, fisheries_col = "fishery_id")
.data |
Dataframe containing 'fishery_id' column (or analogous column with different name specied by 'fisheries_col' argument) |
species |
character atomic identifying either "CHINOOK" or "COHO" (or variations of those). Defaults to 'NULL'; only needed if '.data' does not have species defined as an attribute. Tables read from a fram database using 'framrsquared' package automatically have appropriate species attribute. |
fisheries_col |
character atomic identifying the column treated as containing fishery_id values Defaults to 'fishery_id'. |
Data frame with additional column 'fishery_label'
## create example data dat = data.frame(fishery_id = sample(1:73, size = 10, replace = TRUE)) ## Add fishery label dat |> label_fisheries(species = "CHINOOK")## create example data dat = data.frame(fishery_id = sample(1:73, size = 10, replace = TRUE)) ## Add fishery label dat |> label_fisheries(species = "CHINOOK")
Streamlined version of using 'left_join', 'rename', and 'relocate' to add human-readable text to a dataframe with stock_id or similar columns. Automatically detects species and 'stock_id' column; user can specify species or alternative name for stock_d column if needed.
label_stocks(.data, species = NULL, stocks_col = "stock_id")label_stocks(.data, species = NULL, stocks_col = "stock_id")
.data |
Dataframe containing 'stock_id' column (or analogous column with different name specied by 'stocks_col' argument) |
species |
character atomic identifying either "CHINOOK" or "COHO" (or variations of those). Defaults to 'NULL'; only needed if '.data' does not have species defined as an attribute. Tables read from a fram database using 'framrsquared' package automatically have appropriate species attribute. |
stocks_col |
character atomic identifying the column treated as containing stock_id values Defaults to 'stock_id'. |
Data frame with additional column 'stock_label'
## create example data dat = data.frame(stock_id = sample(1:73, size = 10, replace = TRUE)) ## Add stock information dat |> label_stocks(species = "CHINOOK")## create example data dat = data.frame(stock_id = sample(1:73, size = 10, replace = TRUE)) ## Add stock information dat |> label_stocks(species = "CHINOOK")
Maps between the limiting stock of the Coho TAMM (e.g., 'Hood Canal Wild') and FRAM stock ids. Useful for summarizing impacts on stocks of concern.
limiting_stock_coholimiting_stock_coho
A tibble with 10 rows and 2 columns:
Name of the limiting stock
Exact match of limiting stock name in the TAMM
a list of numeric vectors, each containing all fram stock_id values for that TAMM limiting stock
#' @source 2024 Pre-Season Chinook DB.mdb
For more about the Regional Mark Information System (RMIS), see https://www.rmpc.org/.
rmis_framrmis_fram
## 'rmis_fram' A data frame with 225,390 rows and 4 columns:
RMIS PSC Recovery Location
Gear Code
FRAM fishery ID
FRAM fishery name
<https://github.com/FRAMverse/framr/blob/master/xlsx/lu_coho.xlsx
Mapping of stock_id to stock name for Chinook salmon, taken from the 'Stock' table of the Chinook FRAM database.
stock_chinook_framstock_chinook_fram
A data frame with 78 rows and 7 columns:
Species name
Chinook stock id number in FRAM
Chinook stock name in FRAM
'stock_name' but more human readable
2024 Pre-Season Chinook DB.mdb
Mapping of FRAM stock_id to FRAM stock name for Coho salmon, taken from the 'Stock' table of the Coho FRAM database.
stock_coho_framstock_coho_fram
A data frame with 78 rows and 7 columns:
Species name
Coho stock id number in FRAM
Coho stock name in FRAM
'stock_name' but more human readable
Identifier for which of the limiting stock names of the Coho TAMM (sheet '2') this stock contributes to, if any.
#'
As 'limiting_stock_name', but exact match to name in TAMM.
2024NOF_CohoFRAMdatabase_distribution.mdb
Mapping of FRAM stock_id to PSC stock id and psc stock names, based on the AnnualReport R package.
stock_coho_pscstock_coho_psc
A data frame with 41 rows and 4 columns:
Species name
Coho stock id number in FRAM
Corresponding PSC stock ID
PSC stock name
https://github.com/PSC-CoTC/AnnualReport
Mapping of timestep numbers to dates in the year, taken from the 'TimeStep' table of the Chinook FRAM database
timestep_chinook_framtimestep_chinook_fram
A data frame with 4 rows and 5 columns:
Species name
id number for the time step
Span of each timestep. Timesteps start on the first of the month, and end on the last of the month. Note that 'Oct-Apr-2' is highlighting that timestep 4 runs from October of the current year to April of the NEXT year (equivalent to timestep 1 of the following year).
'time_step_name', but months are written out
2024 Pre-Season Chinook DB.mdb
Mapping of timestep numbers to dates in the year, taken from the 'TimeStep' table of the Chinook FRAM database
timestep_coho_framtimestep_coho_fram
A data frame with 5 rows and 5 columns:
Species name
id number for the time step
Span of each timestep. Timesteps start on the first of the month, and end on the last of the month.
'time_step_name', but months are written out consistently
2024NOF_CohoFRAMdatabase_distribution.mdb
Lookup table for FRAM to TOCAS
tocas_framtocas_fram
## 'tocas_fram' A data frame with 10,462 rows and 6 columns:
1 = Non-Treaty / 2 = Treaty
Gear Code
Dispostion. "COMM" = Commercial, "C&SF" = Ceremonial and Subsistence fishing, "ORGN" = , "Test" and "TEST" = Test fishery (?), TKHM = ??
Catch area code, not zero-padded
FRAM fishery ID
FRAM fishery name
<https://github.com/FRAMverse/framr/blob/master/xlsx/lu_coho.xlsx
Lookup table for FRAM to WAFT
waft_framwaft_fram
## 'waft_fram' A data frame with 10,462 rows and 6 columns:
1 = Non-Treaty / 2 = Treaty
Gear Code
Dispostion. "COMM" = Commercial, "C&SF" = Ceremonial and Subsistence fishing, "ORGN" = , "Test" and "TEST" = Test fishery (?), TKHM = ??
Catch area code, zero-padded
FRAM fishery ID
FRAM fishery name
<https://github.com/FRAMverse/framr/blob/master/xlsx/lu_coho.xlsx