calculateLogbookPartitionByTrip: Calcualte catch partition

View source: R/logbookAnalyses.R

calculateLogbookPartitionByTripR Documentation

Calcualte catch partition

Description

Partitions total catch of each species for each trip on provided grouping variables. NAs in weights are ignored (treated as zero).

Usage

calculateLogbookPartitionByTrip(
  logbooks,
  groupCols,
  tripCol = "tripid",
  speciesCol = "FANGSTART_FAO",
  weightCol = "RUNDVEKT"
)

Arguments

logbooks

data.table with logbooks

groupCols

character() vector of names identifying the grouping columns in 'logbooks'

tripCol

character() identyfing the column in 'logbooks' that identify a trip

speciesCol

character() identyfing the column in 'logbooks' that specify species.

weightCol

character() identifying the column in 'logbboks' that specify the live weight of the species.

Details

Default parameters are compatible readErsFile with tripids annotated by appendTripIdLogbooks.

For other partitionings of logbooks, consider tabulateFisheries.

Value

TripPartition

Examples

 ## Not run: 
  #make calculate fractions in each area for each trip
  lssfile <- "" #set appropriately
  logbfile <- "" #set appropriately
  landings <- RstoxData::readLssFile(lssfile)
  logbooks <- RstoxData::readErsFile(logbfile)
  tripIds <- makeTripIds(landings)
  logbooksWtripIds <- appendTripIdLogbooks(logbooks, tripIds)

  logbooksWtripIds$mainArea <- substring(logbooksWtripIds$LOKASJON_START,1,2)
  fractions <- calculateLogbookPartitionByTrip(logbooksWtripIds, "mainArea")
 
## End(Not run)

StoXProject/RstoxFDA documentation built on Jan. 13, 2024, 12:32 a.m.