Converts year and age x year objects in fit$rep to long (tidy) data frames.
Arguments
- fit
A fitted TAM object as returned by
fit_tam().
Value
A named list of data frames (e.g., N, abundance, ssb, F, F_bar),
where each data frame has one column per dimension (e.g., year, age),
a value column est, and an is_proj column.
Examples
fit <- fit_tam(
cod_obs,
years = 1983:2024,
ages = 2:14,
N_settings = list(process = "iid", init = "exp"),
F_settings = list(process = "rw", mu_form = NULL),
M_settings = list(process = "off", mu_supplied = ~ I(0.3)),
catch_settings = list(sd_form = ~ 1),
index_settings = list(sd_form = ~ 1, q_form = ~ q_block),
silent = TRUE
)
trends <- tidy_rep(fit)
names(trends)
#> [1] "N_plus" "P" "W" "W_catch"
#> [5] "recruitment" "N" "abundance" "M"
#> [9] "mu_M" "M_bar" "F" "mu_F"
#> [13] "F_full" "F_bar" "S" "Z"
#> [17] "biomass_mat" "biomass" "ssb_mat" "ssb"
#> [21] "total_catch" "total_catch_pred" "total_yield" "total_yield_pred"
head(trends$N)
#> year age est is_proj unit
#> 1 1983 2 485911.1 FALSE thousand fish
#> 2 1984 2 269982.4 FALSE thousand fish
#> 3 1985 2 133399.9 FALSE thousand fish
#> 4 1986 2 100317.8 FALSE thousand fish
#> 5 1987 2 188435.4 FALSE thousand fish
#> 6 1988 2 203844.2 FALSE thousand fish