action_report.Rd
Add report to a g3 model
g3a_report_stock(report_stock, input_stock, report_f,
include_adreport = FALSE,
run_f = TRUE,
run_at = g3_action_order$report)
g3a_report_history(
actions,
var_re = "__num$|__wgt$",
out_prefix = "hist_",
run_f = TRUE,
run_at = g3_action_order$report)
g3a_report_detail(actions,
run_f = quote( g3_param('report_detail', optimise = FALSE, value = 1L) == 1 ),
abundance_run_at = g3_action_order$report_early,
run_at = g3_action_order$report)
The g3_stock
to aggregate into
The g3_stock
that will be aggregated
formula specifying what to collect, for instance g3_formula( stock_ss(input_stock__num) )
or g3_formula( stock_ss(input_stock__wgt) )
.
List of actions that model will consist of.
Regular expression specifying variables to log history for.
Prefix to add to history report output, e.g. hist_ling_imm__num
.
Should the aggregated value get ADREPORT'ed?
Integer order that abundance will be collected within the model. Note that by default it's collected at the start, not the end
formula specifying a condition for running this action, default always runs.
Integer order that actions will be run within model, see g3_action_order
.
The actions will define the following variables in your model:
Results of collating input_stock__instance_name, where
instance_name is defined by the first instance variable in report_f.
For example, if report_f is ~input_stock__num
, then we will report report_stock__num
.
A model can have any number of g3a_report_*
actions, so long as the
calling arguments are different. For instance, run_f = ~age == 5
and
run_f = ~age == 7
.
An action (i.e. list of formula objects) that will...
Iterate over input_stock, collecting data into report_stock
Add the contents of report_stock__instance_name to the model report
ling_imm <- g3_stock('ling_imm', seq(20, 156, 4)) %>% g3s_age(3, 10)
# Report that aggregates ages together
agg_report <- g3_stock('agg_report', c(1)) %>%
g3s_agegroup(list(young = 1:3, old = 4:5)) %>%
g3s_time(year = 2000:2002)
# Generate dissaggregated report by cloning the source stock, adding time
raw_report <- g3s_clone(ling_imm, 'raw_report') %>%
g3s_time(year = 2000:2002)
actions <- list(
g3a_age(ling_imm),
g3a_report_stock(agg_report, ling_imm, g3_formula( stock_ss(ling_imm__num) ),
include_adreport = TRUE),
g3a_report_stock(raw_report, ling_imm, g3_formula( stock_ss(ling_imm__num) )))
# "raw_report__num" and "agg_report__num" will be available in the model report
# In addition, agg_report__num will be included in TMB::sdreport() output
# Report history of all "__num" and "__wgt" variables
actions <- c(actions, list(g3a_report_history(actions)))
# Report history of just "ling_imm__num"
actions <- c(actions, list(g3a_report_history(actions, "^ling_imm__num$")))
# Add a detail report suitable for g3_fit
actions <- c(actions, list(g3a_report_detail(actions)))