getComps | R Documentation |
getComps()
first sets up the local environment and returns summaries by
groupings.
getComps(
Pdata,
strat = NULL,
Comps = c("LEN", "AGE", "AAL"),
defaults = c("fleet", "fishyr", "season"),
towid = c("SAMPLE_NO"),
weightid = "Final_Sample_Size_L",
verbose = TRUE
)
Pdata |
A data frame returned from |
strat |
A vector of column names to stratify the output over. For
example, if you wish to summarize by ageing method, then the argument
would look like |
Comps |
The type of composition data to create. See the function call
for the available options. The first option listed is the default, which
creates conditional age-at-length compositions by adding both |
defaults |
The default stratification columns which will typically be
left at their default value of |
towid |
A vector of character values providing the column names that
generate a unique id for each sample. The default is |
weightid |
A character value giving the column name that holds the value
to be summed for each type and strata, such as |
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., |
This function uses the expansions created in getExpansion_1()
and
getExpansion_2()
using "weightid"
. Thus, whatever column name is passed
to weightid
will be used as the weight for each group. See the
documentation for the pass-through arguments, i.e., ...
. If you are
interested in generating unexpanded comps, then use the get_raw_comps()
function from the nwfscSurvey package.
A long data frame of weights for each grouping structure. Columns identifying the grouping structures will come first, followed by columns with sample sizes per group by sex category. The documentation for these sample size columns is sparse because this function is set to be deprecated next cycle and replaced with a simplified path to writing composition data. But, information is present for males (abbreviated with an M), females (abbreviated with an F), unsexed (abbreviated with a U). If no sex is provided then it is assumed all are unsexed and will be returned as such.
Andi Stephens, Kelli F. Johnson
getExpansion_2()
should be run before this function.
writeComps()
can be run on the output from this function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.