groupByGenet {plantTracker} | R Documentation |
Group polygon observations together into a 'genet' based on proximity
Description
This function assigns a unique 'genetID' to polygons if they are within a user-defined distance from one another. Each ramet is still represented by a single row of data, but all ramets of the same genet have the same 'genetID'.
Usage
groupByGenet(dat, buffGenet, ...)
Arguments
dat |
An sf object that contains polygons to be grouped. Typically
should include data only for one species, one quadrat, and one year. For
intended use, this dataset should be of the format described in
|
buffGenet |
A numeric argument indicating half of the maximum distance
between individual ramets (polygons) that the function will group together as
one genet. Note that this argument is in the same units that are used in the
'dat' argument. For example, if buffGenet = 0.005 and we use the
|
... |
Other arguments passed on to methods. Not currently used. |
Details
If polygons are 'grouped,' they are given the same number in the
'genetID' column. This assignment is made using network analysis to group
together polygons that are closest to one another. In the context of
plantTracker, this function was designed to group ramets (vegetative
clones) together into one genet (genetically distinct individual). This
function was designed for use within the assign
function (and
then the trackSpp
function), but can be used independently.
Value
A numeric vector of unique genetIDs that is as long as the number of
rows in 'dat.' Each element i
in the output is the genetID for the
i
th row in 'dat'.
See Also
assign()
and trackSpp()
, plantTracker functions that apply
this function across multiple species, quadrats, and years.
Examples
dat <- grasslandData[grasslandData$Site == "AZ" &
grasslandData$Quad == "SG2" &
grasslandData$Species == "Bouteloua rothrockii" &
grasslandData$Year == 1922,]
groupByGenet(dat = dat, buffGenet = 0.01)
groupByGenet(dat = dat, buffGenet = 0.1)