Converts length frequencies to age frequencies by assigning length-bin centers to age intervals derived from cohort-specific mean lengths.
Arguments
- data
A
listcontaining model data passed toMakeADFun. Must include:n_lf(integer, number of length frequency observations),n_age(integer, number of age classes),age_a(numeric vector of age classes),lf_year(integer vector of years),lf_season(integer vector of seasons), andlength_mu_ysa(3D array of mean length-at-age by year, season, and age).- lf_data
A
data.framecontaining length frequency data. Must include columns forFishery,Year,N, and additional columns representing length bins with numeric column names.
Value
A list with two components:
- lf_slices
A
matrixof dimensionsn_lfx (number of length bins) containing the age bin assignments for each length bin.- af_sliced
A
matrixof dimensionsn_lfxn_agecontaining the sliced age frequencies, with column names corresponding to age classes.
Details
Rows of lf_data must be in exactly the same order as
data$lf_year and data$lf_season; this helper does not join
or reorder them. The lf_slices matrix stores the underlying integer
codes returned by cut(), whereas af_sliced has labeled age
columns. Empty inputs and non-increasing mean lengths are not supported.
