
Assign each observation in the primary dataset to a fishery management or regulatory zone Assign each observation in the primary dataset to a fishery management or regulatory zone. Function is primarily called by other functions that require zone assignment but can also be used on its own.
Source:R/assignment_column.R
assignment_column.RdAssign each observation in the primary dataset to a fishery management or regulatory zone
Assign each observation in the primary dataset to a fishery management or regulatory zone. Function is primarily called by other functions that require zone assignment but can also be used on its own.
Usage
assignment_column(
dat,
project,
spat,
lon.dat,
lat.dat,
cat,
name = "ZoneID",
closest.pt = FALSE,
bufferval = NULL,
lon.spat = NULL,
lat.spat = NULL,
hull.polygon = FALSE,
epsg = NULL,
log.fun = TRUE
)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 containing information on fishery management or regulatory zones.
sfobjects are recommended, butspobjects can be used as well. If using a spatial table read from a csv file, then argumentslon.spatandlat.spatare required. To upload your spatial data to the FishSETFolder seeload_spatial.- lon.dat
Longitude variable in
dat.- lat.dat
Latitude variable in
dat.- cat
Variable or list in
spatthat identifies the individual areas or zones. Ifspatis classsf,catshould be name of list containing information on zones.- name
The name of the new assignment column. Defaults to
"ZoneID".- closest.pt
Logical, if
TRUE, observations that fall outside zones are classed as the closest zone polygon to the point.- bufferval
Maximum buffer distance, in meters, for assigning observations to the closest zone polygon. If the observation is not within the defined
bufferval, then it will not be assigned to a zone polygon. Required ifclosest.pt = TRUE.- lon.spat
Variable or list from
spatcontaining longitude data. Required for spatial tables read from csv files. Leave asNULLifspatis ansforspobject.- lat.spat
Variable or list from
spatcontaining latitude data. Required for spatial tables read from csv files. Leave asNULLifspatis ansforspobject.- hull.polygon
Logical, if
TRUE, creates convex hull polygon. Use if spatial data creating polygon are sparse or irregular.- epsg
EPSG code. Manually set the epsg code, which will be applied to
spatanddat. If epsg is not specified but is defined forspat, then thespatepsg will be applied todat. In addition, if epsg is not specified and epsg is not defined forspat, then a default epsg value will be applied tospatanddat(epsg = 4326). See http://spatialreference.org/ to help identify optimal epsg number.- log.fun
Logical, whether to log function call (for internal use).
Details
Function uses the specified latitude and longitude from the primary
dataset to assign each row of the primary dataset to a zone. Zone polygons
are defined by the spatial dataset. Set hull.polygon to TRUE
if spatial data is sparse or irregular. Function is called by other functions
if a zone identifier does not exist in the primary dataset.