
Create distance between points variable - non-interactive version
Source:R/create_dist_between_gui.R
create_dist_between_for_gui.RdAdds distance between two points to the primary data set. There are two versions of this function. The difference between the two versions is
how additional arguments specific to start and end locations are added. This
version requires all necessary arguments to be specified before running and is best used in a non-interactive session.
The create_dist_between version requires only five arguments to be specified before running. Additional arguments
specific to identifying the lat/long of start or end points are added through prompts. This function is designed for an
interactive session. Both versions of the distance between function require that the start and end points be different vectors.
If the start or ending points are from a port, then PortTable must be specified to obtain lat/lons. If the start or ending
points are the center of a fishing zone or area then spat, lon.dat, lat.dat, cat, lon.spat, and lat.spat
must be specified to obtain latitude and longitude.
Arguments
- dat
Primary data containing information on hauls or trips. Table in FishSET database contains the string 'MainDataTable'.
- project
Project name
- start, end
Starting location. Should be a port, lat/lon location, or centroid of regulatory zone/area.
port: startshould be the column name indatcontaining the port names. Latitude and longitude for the port are extracted from the port table.lat/lon: startshould be a character string of column names fromdat. The order must be `lat` then `lon`start=c('lat', 'lon').- units
Unit of distance. Choices are
"miles","kilometers", or"midpoint".- name
String, name of new variable. Defaults to `DistBetween`.
- portTable
Data table containing port data. Required if
startorendare a vector from thedatcontaining port names.- zoneid
Variable in
datthat identifies the individual zones or areas. Required if zone identifier variable exists and is not `ZoneID`. Defaults to NULL.- spat
Spatial data containing information on fishery management or regulatory zones. Shape, json, geojson, and csv formats are supported. Required if
startorendare"centroid"and a centroid table doesn't exist in the FishSET database.- lon.dat
Longitude variable from
dat. Required ifstartorendare ‘centroid’.- lat.dat
Latitude variable from
dat. Required ifstartorendare ‘centroid’.- cat
Variable or list in
spatthat identifies the individual areas or zones. Ifspatis class sf,catshould be name of list containing information on zones. Required ifstartorendare"centroid".- lon.spat
Variable or list from
spatcontaining longitude data. Required for csv files. Leave as NULL ifspatis a shape or json file, Required ifstartorendare"centroid".- lat.spat
Variable or list from
spatcontaining latitude data. Required for csv files. Leave as NULL ifspatis a shape or json file, Required ifstartorendare"centroid".