Create a zonal or fishing centroid table. The centroid can be joined with the
primary data if output = "dataset". The centroid table is automatically
saved to the FishSET Database.
Usage
create_centroid(
spat = NULL,
dat = NULL,
project,
spatID = NULL,
zoneID = NULL,
lon.dat = NULL,
lat.dat = NULL,
weight.var = NULL,
type = "zonal centroid",
names = NULL,
cent.name = NULL,
output = "dataset"
)Arguments
- spat
Spatial data containing information on fishery management or regulatory zones. Required for
type = "zonal centroid", not required fortype = "fishing centroid".spatwill be included in centroid table name.- dat
Primary data containing information on hauls or trips. Table in FishSET database contains the string 'MainDataTable'.
datis not required iftype = "zonal centroid"andoutput = "centroid table".- project
Name of project.
- spatID
Variable or list in
spatthat identifies the individual areas or zones. Ifspatis class sf,spatIDshould be name of list containing information on zones. Ignored iftype = "fishing centroid".- zoneID
Variable in
datthat identifies zonal assignments.zoneIDis not required iftype = "zonal centroid"andoutput = "centroid table".- lon.dat
Longitude variable in
dat. Required fortype = "fishing centroid".- lat.dat
Latitude variable in
dat. Required fortype = "fishing centroid".- weight.var
Variable from
datfor weighted average (fortype = "fishing centroid". only). Ifweight.varis defined, the centroid is defined by the latitude and longitude of fishing locations in each zone weighted byweight.var.- type
The type of centroid to create. Options include
"zonal centroid"and"fishing centroid". See other arguments fortyperequirements.- names
Character vector of length two containing the names of the fishing centroid columns. The order should be
c("lon_name", "lat_name"). The default names arec("weight_cent_lon", "weight_cent_lat")for weighted fishing centroid andc("fish_cent_lon", "fish_cent_lat")for unweighted fishing centroid.- cent.name
A string to include in the centroid table name. Table names take the form of
"projectNameZoneCentroid"for zonal centroids and"projectNameFishCentroid"for fishing centroids.- output
Options are
"centroid table","dataset", or"both"."centroid table"returns a table containing the zone name and the longitude and latitude of the centroid."dataset"returns the primary table joined with the centroid table."both"returns a list containing the merged primary table and the centroid table.
