View source: R/getExpansion_2.R
getExpansion_2 | R Documentation |
The second-stage expansion calculates the expansion factor based on the ratio of total catch within a stratification (e.g., year, gear group) to the amount of that catch that was sampled.
getExpansion_2(
Pdata,
Catch,
Units = c("MT", "LB"),
Convert = NULL,
maxExp = 0.95,
stratification.cols,
verbose = TRUE,
savedir
)
Pdata |
A data frame of biological samples
originating from the
Pacific Fishieries Information Network (PacFIN) data warehouse,
which originated in 2014. Data are pulled using sql calls, see
|
Catch |
A data frame of catch data, in pounds or in metric tonnes. |
Units |
The units of the |
Convert |
A deprecated argument that is now set to |
maxExp |
The maximum expansion factor
(either a number or a quantile) for building expansions.
Typically, the default is 0.95.
Set |
stratification.cols |
A vector of column names in |
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., |
savedir |
A file path to the directory where the results will be saved. The default is the current working directory. The path can be relative or absolute. |
Find the catch for each year and grouping in Catch
and divide by the
pounds of fish that were collected for sampling for that same year and
grouping. Sampled biomass is stored in All_Trips_Sampled_Lbs
, which is
the sum of Trip_Sampled_Lbs across sample numbers.
Catches were already stratified (i.e., summed by group placed in a column
for a given year or row). Catches are converted to pounds prior to dividing.
Thus, per-stratum Expansion_Factor_2 is the catch / sampled catch.
The input PacFIN dataset, with column Expansion_Factor_2
appended.
Age data are expanded separately from lengths.
WA fish are generally only expanded using Expansion_Factor_2.
Other expansions are the product of Expansion_Factor_1 * Expansion_Factor_2
For age-at-length comps, set Final_Expansion_Factor to 1 because each fish represents only itself.
Andi Stephens
getExpansion_2
is ran after getExpansion_1 using the
returned data frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.