PacFIN.Utilities: PacFIN.Utilities: Functions for working up PacFIN biological...

Description Details Workflow Example Runthrough Filtering functions Summary functions Optional functions Expansion functions Expansion caveats Compostition functions Infrequentily used functions


The PacFIN.Utilites package provides functions for filtering, summarizing, expanding, and compiling composition data, and writing out the final products: length- age- and age-at-length compositions.


Many of the functions described below write summary output to the console, and several create plots for visualizing data at various steps in processing. The information written to the console can be captured using the sink function to encapsulate your workflow:

sink("myfilename.txt", split=TRUE)

... do work ...


The second call closes the file.


There are 15 functions in this package, and they are sensitive to the order in which they are run. You can see diagram of the workflow you can expect to follow Workflow, as well as additional notes.

Example Runthrough

There is a complete runthrough of example data (species: XMPL) available so that you can experiment with the package. Use help(PacFIN_Example) to see how to filter, stratify and expand the data, and create length- age- and age-at-length-compositions.

Filtering functions

cleanPacFIN Filters raw PacFIN data
cleanAges Filters for age data

Summary functions

plotRawData Plots commonly viewed raw PacFIN data
plotCleaned Plots the product of cleanPacFIN similarly.

In addition, the getExpansion_1 function has a "plot" argument to create plots documenting the expansions it creates. It also writes summary output to the console.

Optional functions

combineCalCOM For combinining PacFIN and CalCOM data
getSeason For treating data from seasonal fisheries, such as Petrale.
Stratify Reduces the values in a data column to an encoded or named subset.

Expansion functions

getExpansion_1 creates the values for the sample to tow expansion.
getExpansion_2 computes the expansion values from the tow upwards to a
user-specified stratification

Expansion caveats

There is one manual step in the workflow. After running the expansion functions, data columns Expansion_Factor_1 and Expansion_Factor_2 are available to use in manually setting the Final_Expansion_Factor.

Compostition functions

getComps uses the Final_Sample_Size and the user-specified stratification to create comps.
doSexRatio separates the unsexed fish into males and females
writeComps formats the composition data for SS3 and writes it to a file.

Infrequentily used functions

You can run these manually to reset the inital values.

getState Run by cleanPacFIN to initialized the state column.
getGearGroup Run by cleanPacFIN to initialize geargroups.
capValues Used to limit the maximum value in a vector.

nwfsc-assess/PacFIN.Utilities documentation built on June 30, 2017, 8:49 a.m.