library(magrittr)
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)))
Run the code above in your browser using DataLab