Skip to contents

Creates a variable containing the zone/area location of a vessel when choice of where to fish next was made. This variable is required for data with multiple sets or hauls in a single trip and for the full information model with Dahl's correction (logit_correction).

Usage

create_startingloc(
  dat,
  project = NULL,
  spat,
  port,
  port_name,
  port_lon,
  port_lat,
  trip_id,
  haul_order,
  starting_port,
  zoneID,
  spatID,
  name = "startingloc"
)

Arguments

dat

Primary data containing information on hauls or trips. Table in FishSET database contains the string 'MainDataTable'.

project

Name of project

spat

Spatial data. Required if ZoneID does not exists in dat. Shape, json, geojson, and csv formats are supported.

port

Port data. Contains columns: Port_Name, Port_Long, Port_Lat. Table is generated using the load_port and saved in the FishSET database as the project and port table, for example 'pollockPortTable'.

port_name

Character string indicating the column in port table that contains the port name

port_lon

Character string indication the column in port table that contains port longitude

port_lat

Character string indication the column in port table that contains port latitude

trip_id

Variable in dat that identifies unique trips.

haul_order

Variable in dat containing information on the order that hauls occur within a trip. Can be time, coded variable, etc.

starting_port

Variable in dat to identify port at start of trip.

zoneID

Variable in dat that identifies the individual zones or areas.

spatID

Variable in spat that identifies the individual zones or areas.

name

String, name of created variable. Defaults to name of the function if not defined.

Value

Primary data set with starting location variable added.

Details

Function creates the startloc vector that is required for the full information model with Dahl's correction logit_correction. The vector is the zone location of a vessel when the decision of where to fish next was made. Generally, the first zone of a trip is the departure port. The assignment_column function is called to assign starting port locations and haul locations to zones. If ZoneID exists in dat, assignment_column is not called and the following arguments are not required: spat, lon.dat, lat.dat, cat, lon.grid, lat.grid.

Examples

if (FALSE) {
pcodMainDataTable <- create_startingloc(pcodMainDataTable, 'pcod',
    map2, "pcodPortTable", "TRIP_SEQ", "HAUL_SEQ", "DISEMBARKED_PORT", 
 "START_LON", "START_LAT", "NMFS_AREA", "STARTING_LOC"
)
}