Calculate unexpanded/raw length or marginal age compositions
get_raw_comps.Rd
Calculate unexpanded/raw length or marginal age compositions
Usage
get_raw_comps(
data,
comp_bins,
comp_column_name = "Length_cm",
input_n_method = c("stewart_hamel", "tows", "total_samples"),
two_sex_comps = TRUE,
fleet = "Enter Fleet",
month = "Enter Month",
partition = 0,
age_error = "Enter Age Error Vector",
age_low = -1,
age_high = -1,
dir = NULL,
printfolder = "forSS3",
verbose = TRUE
)
Arguments
- data
A data frame that includes columns of year, sex, and length/ages. The data frame can be survey data pulled using pull_bio from the data warehouse or any data frame that includes column names of sex, year, and the comp_column_name. The sex column is expected to have sexes denoted by F, M, and U.
- comp_bins
A vector on length bins or age bins to create compositions across. The composition data is formatted for Stock Synthesis.
- comp_column_name
The column name to create composition data for. This column can be is used to determine whether to format the composition data for length or age compositions by looking for either age (e.g.,
age_years
,Age
,best_age
) or length (e.g.,Length
,length
,Length_cm
) in the comp_column_name. The default isLength_cm
.- input_n_method
Determines the default input sample size to add to the composition data for SS3. There are three options: c("stewart_hamel", "tows", "total_samples") where the default is "stewart_hamel".
- two_sex_comps
Default TRUE. If TRUE composition data will be formatted for a Stock Synthesis two-sex model and if FALSE composition data will be formatted for a single-sex model.
- fleet
A fleet number to assign the composition data to based on the expected format for Stock Synthesis. Default "Enter Fleet".
- month
Month the samples were collected based on the expected format for Stock Synthesis to determine the length/age estimate to compare to. Default "Enter Month".
- partition
Partition to assign the composition data based on the expected format for Stock Synthesis. Partition of 0 indicates that the composition data include all composition data, 1 for discarded composition data, and 2 for retained fish only. Default of 0.
- age_error
Number of ageing error vector to apply to the age data based on Stock Synthesis. Default "Enter Age Error Vector".
- age_low
Lower age bin for all age composition data based on the expected format for Stock Synthesis. Default value of -1 which translates to the lowest age bin.
- age_high
Upper age bin for all age composition data based on the expected format for Stock Synthesis. Default value of -1 which translates to the highest
- dir
Directory where output will be saved. The directory where the file should be saved. If dir = NULL no output will be saved.
- printfolder
A string that will be appended to
dir
, creating a folder where the output will be saved. If specified as""
, the output will just be saved directly indir
. The default is"forSS3"
.- verbose
A logical that specifies if you want to print messages and warnings to the console. The default is
TRUE
.
Value
A list of length or marginal age compositions for sexed and unsexed fish formatted for Stock Synthesis.
Details
Creates a matrix of unexpanded (or raw) marginal length or age composition data formatted for Stock Synthesis. The code will return composition data for all sexes present in the data frame and no sex assignment is done for unsexed fish. The function will create composition data for either lengths or ages based on the comp_column_name. The function will return a list of composition data based upon the sexes present in the data for a two-sex model or all length/ages for single-sex model.