getComps.Rd
getComps()
first sets up the local environment and returns summaries by
groupings.
A data frame returned from PullBDS.PacFIN()
containing
biological samples. These data are stored in the Pacific Fishieries
Information Network (PacFIN) data warehouse, which originated in 2014 and
are pulled using sql calls.
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 strat = "agemethod"
or, if you want to look at fleets
and gear, strat = c("fleet", "usegear")
.
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 lengthcm
and Age
to the grouping structure.
The default stratification columns which will typically be
left at their default value of c("fleet", "fishyr", "season")
.
A vector of character values providing the column names that
generate a unique id for each sample. The default is "SAMPLE_NO"
but you
can pass a vector where all of the columns identified will be united to
create a unique identifier for the tow/sample.
A character value giving the column name that holds the value
to be summed for each type and strata, such as weightid = "Final_Sample_Size_L"
, if you are interested in length data. Instead of
the default, you might want to weight each stratification by the final
sample sizes found for age data, i.e., weightid = "Final_Sample_Size_A"
.
You can pass weightid
any column that exists in Pdata
. Legacy code did
not allow you to name the column and Final_Sample_Size
was hard coded in
the function.
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.
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., ...
getExpansion_2()
should be run before this function.
writeComps()
can be run on the output from this function.