formatCatch | R Documentation |
Transform a long data frame of catches to a wide data frame using tidyr::pivot_wider. The column names of the wide data frame will be in the format needed for the stratification of stage-2 expansions of composition data, i.e., getExpansion_2.
formatCatch(
catch,
strat,
yearname = "^Year|^Yr|Landing_Y|Sample_Y",
valuename = "ROUND_WEIGHT_LBS"
)
catch |
A data frame with at least a column specifying the year the catches took place (e.g., LANDING_YEAR is the column name upon download from PacFIN), a column for variable(s) specified in strat, and a column that holds the measured catches named (e.g., ROUND_WEIGHT_LBS is the column name upon download from PacFIN). |
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 |
yearname |
A character string used to search for year in |
valuename |
The column name that contains the
catch values in the data frame |
A data frame in wide format with yearname
being the first column
ordered from oldest to newest. Stratification columns follow and the names
are separated with a full stop when more than one stratification is provided.
Values in the rows will be the valuename
summed across all available values.
If there are no relevant values for a given stratification-year combination,
then the entry will be zero.
Kelli F. Johnson
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.