tableSample: Table of Sample Size By Fleet and Year

View source: R/tableSample.R

tableSampleR Documentation

Table of Sample Size By Fleet and Year

Description

Create a table of samples by fleet and year to be included in an assessment document.

Usage

tableSample(
  Pdata,
  fname = paste0("fishery_", comps, "_samples.csv"),
  strat = "SOURCE_AGID",
  comps = c("LEN", "AGE"),
  remove_yrs = NULL
)

Arguments

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 PullBDS.PacFIN().

fname

A filename with the appropriate extension, used to save the function output to the disk. For example, LenComps.csv or file.path(getwd(), "SampleSize.csv"). Full, relative, or simple paths are allowed because the argument is used as is, i.e., not redirected to a directory different than getwd(). Note that various functions within PacFIN.Utilities have different default values for this input argument.

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 strat = "agemethod" or, if you want to look at fleets and gear, strat = c("fleet", "usegear").

comps

Specify whether to calculate the length or Age samples. The default is to calculate the number of length samples.

remove_yrs

A vector of years to remove from the data before summarizing sample sizes. The default of NULL leads to no sub setting of the data.

Value

A table is written to a csv file as specified in fname and the data frame is also returned as an object invisibly.

Author(s)

Chantel R. Wetzel


nwfsc-assess/PacFIN.Utilities documentation built on March 19, 2024, 11:54 p.m.