Take the long-format, which is indicative of raw data, weight-at-age data and make a wide data frame based on ages such that the data frame can be written for Stock Synthesis.

weight_at_age_wide(dat, value = c("weight", "length", "count"), maxage = 15)

Arguments

dat

A data frame created from weight_at_age_read() or one that has the following column names:

  • Source,

  • Weight_kg,

  • Sex,

  • Age_yrs,

  • Length_cm,

  • Month, and

  • Year.

value

A character value specifying which type of data you are interested in. The options include "weight", "length", and "count", where the latter will supply the sample size.

maxage

The age of the plus-group bin. The default is 15 years old. This age and all older ages will be combined into a single age bin..

Value

A data frame with the first six columns pertaining to metadata, i.e., #Yr, seas, gender, GP, bseas, and fleet, and additional columns pertaining to each age starting with age zero up to the maximum age supplied with the argument maxage. Ages for which there were no samples are filled with NA. If value = "count", then the data frame will return sample sizes for each age rather than mean weight- or length-at-age.

Author

Ian G. Taylor