appendTripIdLandings: Assign trip IDs

View source: R/landingsAnalyses.R

appendTripIdLandingsR Documentation

Assign trip IDs

Description

Assigns trip IDs to landings based on vessel identifier and date of last catch.

Usage

appendTripIdLandings(
  landings,
  tripIds = NULL,
  vesselIdCol = "Radiokallesignal (seddel)",
  lastCatchCol = "Siste fangstdato",
  tripIdCol = "tripid"
)

Arguments

landings

data.table containing landings records

tripIds

data.table with columns 'vesselId', 'time' and 'tripId'

vesselIdCol

character() that identifies a column in 'landings' that contain the vessel id (e.g. radio call signal) of the landing vessel. Default compatible with readLssFile.

lastCatchCol

character() that identifies a POSIXct column in 'landings' that contain the time of last catch for each record. Default compatible with readLssFile.

tripIdCol

character() that identifies the column name to append to 'landings'

Details

if 'tripIds' is NULL, trip IDs will be constructed from landings using makeTripIds

Value

data.table with columns 'vesselId' and 'time'

Examples

 ## Not run: 
   #merge mesh size from first operation on a trip into landings
   lssfile <- "" #set appropriately
   logbfile <- "" #set appropriately
   landings <- RstoxData::readLssFile(lssfile)
   logbooks <- RstoxData::readErsFile(logbfile)
   tripIds <- makeTripIds(landings)
   logbooksWtripIds <- appendTripIdLogbooks(logbooks, tripIds)
   landingsWtripIds <- appendTripIdLandings(landings, tripIds)

   firstCatch <- logbooksWtripIds[!duplicated(logbooksWtripIds$tripid),]
   landingsWmeshSize <- merge(landingsWtripIds,
                              firstCatch[,c("tripid", "MASKEVIDDE")],
                              by="tripid",
                              all.x=T)
 
## End(Not run)

StoXProject/RstoxFDA documentation built on Nov. 12, 2024, 3:42 a.m.