Generates a table showing assumed and projected years of Catch, SB, and F.

table_projections(
  dat,
  unit_label = c(catch = "mt", spawning_biomass = "mt", fishing_mortality = ""),
  interactive = TRUE,
  module = NULL,
  make_rda = FALSE,
  tables_dir = getwd()
)

Arguments

dat

Data frame or list. A tibble or named list of tibbles (input as `list()`) returned from convert_output.

If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.

unit_label

Character vector. Abbreviated unit label for each quantity

Default: c("catch" = "mt", "spawning_biomass" = "mt", "fishing_mortality" = "")

interactive

Logical. TRUE/FALSE; indicate whether the environment is interactive.

Default: `FALSE`

module

Character vector. (Optional) Module name found in `dat$module_name`. If selecting >1 module, place them in a vector like c("module1", "module2").

Default: NULL

If the interactive and >1 module_name is found, user will select the module_name in the console. @seealso [filter_data()]

make_rda

Logical. TRUE/FALSE; indicate whether to save the object and make an automated caption and alternative text in the form of an `rda` object. If TRUE, the rda will be exported to the folder indicated in the argument "figures_dir".

Default: `FALSE`.

tables_dir

Path. The location of the folder containing the generated table rda files ("tables") that will be created if the argument `make_rda` = TRUE.

Default: the working directory (`getwd()`)

Value

A formatted gt table object.

Details

We would like to thank Dan Hennen for sharing his projections table function code, which served as the foundation for this function.

Examples

table_projections(
 dat = stockplotr::example_data,
 interactive = FALSE,
 module = "DERIVED_QUANTITIES")
#>  Processing catch
#>  Processing spawning_biomass
#>  Processing fishing_mortality
Year Catch (mt) (stddev) Spawning Biomass (mt) (stddev) Fishing Mortality (stddev)
2023 3,194.00 (446.07) 8.00 (0.68) 0.20210 (0.02)
2024 3,194.00 (329.53) 8.00 (0.58) 0.20210 (0.02)
2025 3,194.00 (254.6) 8.00 (0.56) 0.20210 (0.01)
2026 3,194.00 (261.59) 8.00 (0.6) 0.20210 (0.01)
2027 3,194.00 (321.12) 8.00 (0.68) 0.20210 (0.02)
2028 3,194.00 (350.68) 8.00 (0.78) 0.20210 (0.02)
2029 3,194.00 (332.97) 8.00 (0.89) 0.20210 (0.02)
2030 3,194.00 (302.66) 8.00 (1.02) 0.20210 (0.02)
2031 3,194.00 (277.54) 8.00 (1.17) 0.20210 (0.03)
2032 3,194.00 (249.08) 8.00 (1.31) 0.20210 (0.03)
2033 3,194.00 (223.08) 8.00 (1.44) 0.20210 (0.03)
2034 3,194.00 (203.64) 8.00 (1.56) 0.20210 (0.03)