Add ageing actions to a g3 model

g3a_age(
        stock,
        output_stocks = list(),
        output_ratios = rep(1/length(output_stocks),
        times = length(output_stocks)),
        run_f = ~cur_step_final,
        run_at = g3_action_order$age,
        transition_at = g3_action_order$age)

Arguments

stock

g3_stock to age.

output_stocks

List of g3_stocks that oldest specimens in stock should move into.

output_ratios

Vector of proportions for how to distribute into output_stocks, default evenly spread.

run_f

formula specifying a condition for running this action, default is end of model year.

run_at

Integer order that actions will be run within model, see g3_action_order.

transition_at

Integer order that transition actions will be run within model, see g3_action_order.

Value

An action (i.e. list of formula objects) that will, for the given stock...

  1. Move the final age group into temporary storage, stock__transitioning_num / stock__transitioning_wgt

  2. Move the contents of all other age groups into the age group above

  3. Move the contents of the temporary storage into output_stocks

If stock has only one age, and output_stocks has been specified, then the contentes will be moved, if output_stocks is empty, then the action will do nothing.

Examples

library(magrittr)
ling_imm <- g3_stock('ling_imm', seq(20, 156, 4)) %>% g3s_age(3, 10)
ling_mat <- g3_stock('ling_mat', seq(20, 156, 4)) %>% g3s_age(5, 15)

# Ageing for immature ling
age_action <- g3a_age(ling_imm,
    output_stocks = list(ling_mat))