writeComps | R Documentation |
Write out composition data to a file, binning the data as specified to work in a Stock Synthesis model. Note, that this function does not work for conditional age-at-length data because it is assumed that one would not want to estimate growth in that way from fishery-dependent data.
writeComps(
inComps,
comp_bins,
fname = NULL,
abins = lifecycle::deprecated(),
lbins = lifecycle::deprecated(),
column_with_input_n = c("n_tows", "n_stewart", "n_fish"),
maxAge = lifecycle::deprecated(),
month = 7,
partition = 2,
ageErr = 0,
dummybins = lifecycle::deprecated(),
sum1 = lifecycle::deprecated(),
digits = 4,
overwrite = lifecycle::deprecated(),
verbose = FALSE
)
inComps |
A dataframe returned from |
comp_bins |
The binning structure to use for ages and lengths. |
fname |
A filename with the appropriate extension, used to save the
function output to the disk. For example, |
abins , lbins |
Deprecated as of 0.2.10 to reduce complication in the code and
make it more intuitive for the user when running this function.
The binning structure to use for ages and lengths. For
both arguments, the default is |
column_with_input_n |
A string providing the column name with the
appropriate value for the input sample size that will be given to Stock
Synthesis as input_n (what we and nwfscSurvey provide as a column name)
or NSamp (what Stock Synthesis wants as a name). The default is |
maxAge |
Deprecated as of 0.2.10 to reduce complication in the code and
make it more intuitive for the user when running this function. All fish
present in |
month |
Month for all observations. Defaults to 7. If input has multiple seasons, this must be a vector of equal length to the maximum seasons where the order of months in the vector will be assigned to season in ascending order. For example, if there are two seasons and the month = c(1, 7) season 1 will be assigned to month 1 and season 2 to month 7. |
partition |
Used by Stock Synthesis for length- or age-composition data where 0 = retained + discarded, 1 = discarded, and 2 = retained fish. The default is to assume that these fish are retained only. The default was changed in 2020 from a value of 0, and code should be updated accordingly if you really want 0. |
ageErr |
Defaults to 1 to use the first ageing error matrix specified in your Stock Synthesis model. |
dummybins |
Deprecated as of version 0.2.10 because you can just run the
function with different |
sum1 |
Deprecated as of version 0.2.10 because SS3 will normalize the
composition data for you and thus it does not need to be done here. The
previous default was |
digits |
Integer indicating the number of decimal places to round value
to (value is passed to |
overwrite |
Deprecated as of version 0.2.10. The file will be automatically overwritten if present. |
verbose |
A logical specifying if output should be written to the
screen or not. Good for testing and exploring your data but can be turned
off when output indicates information that you already know. The printing
of output to the screen does not affect any of the returned objects. The
default is to always print to the screen, i.e., |
The structure of the input dataframe determines whether the results produce age- or length-composition data. As of version 0.2.10, conditional age-at-length compositions are no longer available within this function.
Composition data are raw weights rather than proportions. Stock Synthesis
internally converts these to proportions. The raw weights should be
examined for anomalies. To create proportions use prop.table()
on the
columns containing composition data.
The columns in the output preceding 'lengthcm' or 'Age' are those that were used in stratifying the data.
A data frame is returned and a .csv
is created and written to the disk with
the same data frame.
Andi Stephens, Chantel R. Wetzel, Kelli F. Johnson, Ian G. Taylor
getComps()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.