Skip to contents

Returns the model's derived population quantities in long form so that custom plots and post-processing don't have to walk the deeply nested quantities list or inherit the dimnames decisions in rename_output(). Two shapes are flattened into one tidy frame: species-by-year quantities (e.g. biomass, ssb, R, F_spp) and species-by-sex-by-age-by-year quantities (e.g. N_at_age, biomass_at_age, M_at_age). For the species-level shapes, sex and age are returned as NA. Cells of the 4D arrays that are padded out to max(nsex) / max(nages) for species with fewer sexes or ages are dropped.

Usage

# S3 method for class 'Rceattle'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  which = c("biomass", "ssb", "R", "biomass_depletion", "ssb_depletion", "F_spp"),
  ci_level = 0.95,
  ...
)

Arguments

x

An object of class "Rceattle" returned by fit_mod().

row.names, optional

Ignored; present for the as.data.frame() generic.

which

Character vector of quantity names to extract, or "all" for every quantity with a known shape. Defaults to a common population-level summary. See names(Rceattle:::.RCEATTLE_QUANTITIES) for the full list.

ci_level

Confidence level for lwr and upr. Default 0.95.

...

Currently unused.

Value

A data.frame with columns year, species, sex, age, quantity, value, lwr, upr. species is the character species name from data_list$spnames. Rows are sorted in the order which was given.

Details

Confidence intervals (lwr, upr) are populated from the TMB sdreport for any quantity that was ADREPORT'd (currently biomass, ssb, R); other quantities and fits produced with getsd = FALSE get NA for lwr / upr. Set ci_level to widen or narrow the band.