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

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

Arguments

Pdata

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.

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 pacfintools have different default values for this input argument. If NULL in writeComps, then the resulting file name will be based on what type of composition data is being generated, i.e., PacFIN_lengths.out, or PacFIN_ages.out for length or age data, respectively.

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

Chantel R. Wetzel