Uses output from r4ss::SS_read() and does
filtering, simplifying, and reformatting.
Usage
ss3_data_to_fims(
ss3_dir = NULL,
ss_new = TRUE,
ss3_inputs = NULL,
ss3_output = NULL,
EWAA = NULL,
fleets = NULL,
maxage = NULL,
lengths = NULL,
ageing_error_matrices = NULL
)Arguments
- ss3_dir
Directory containing the SS3 input and output model files. Alternatively the SS3 input and output lists can be input directly using
ss3_inputsandss3_output- ss_new
Logical indicating whether to read in the .ss_new files instead of the original input files. Beneficial for dealing with negative years in the wtatage file which can't yet be processed by this function.
- ss3_inputs
A list containing
datsuch as that created byr4ss::SS_read(). WhenEWAAisTRUE, the list must also containwtatage. Only required ifss3_diris not provided.- ss3_output
A list created by
r4ss::SS_output(). Only required for age-to-length conversion ifss3_diris not provided.- EWAA
Logical indicating whether to use empirical weight-at-age and age_to_length conversion tables from the SS3 model or to rely on the FIMS growth model. If NULL then it will follow the setting in the SS3 control file (
ctl[['EmpiricalWAA']])- fleets
Which fleets to include in the processed output. Note that the only start year population weight-at-age is read from the
wtatageelement (fleet = 0). NULL will default to including all fleets from the SS3 model.- maxage
Max age to include in the processed output. NULL will default to using age 0 up to the maximum age data bin in the SS3 model.
- lengths
Vector of lengths to include in the processed output. Needs to be a subset of the length bins in the SS3 model. NULL will default to using all length data bins from the SS3 model.
- ageing_error_matrices
Optional vector of SS3 age-error definition IDs to convert. If NULL, all positive IDs referenced by retained age-composition data are converted. Definitions omitted from this vector are not applied.
- fleet_column
Name of the column used to identify the fleet.
- label
Label used in the row-count message.
- bin_pattern
Regular expression matching the composition-bin columns.
- data
Output rows for a single data type.
- definition_id
SS3 age-error definition number.
- age
Age bin to look up.
- length
Length bin to look up.
Value
A data frame that can be passed to FIMS::FIMSFrame()
The filtered data frame. Normalize composition bins and reshape them into one row per bin.
Long-format data with fleet, year, sample size, bin, and proportion. Reject conflicting duplicate keys and remove exact repeated observations.
Data with at most one row per identifying key. Calculate observed-age probabilities from one SS3 mean/SD vector pair.
A matrix with true ages in rows and observed ages in columns. Look up the SS3 age-to-length proportion for one age and length bin.
The aggregated proportion, or NA when either bin is out of range.
See also
SS_write() can be used to write the input files using the list
Filter observations to selected fleets and report any rows removed.