This function calculates the bearing angle and distance from all focal individuals in a group to their nearest neighbor over time.
Arguments
- data
A dataframe with the group's positional timeseries for one set. Column names must include:
id
,t
,head
,x
,y
. The calculations are based on theswaRm
package.- add_coords
Logical, whether the data on relative positions of nearest neighbours should be converted into coordinates in the reference frame of the focal individual (
nnx
,nny
). This can be useful for visualization purposes but it is not used in the package pipeling. Default = 'FALSE'.- geo
Logical, whether positions are geographic coordinates, default = FALSE.
- verbose
Logical, whether to post updates on progress.
- parallelize
Logical, whether to parallelize the function over time.
Value
The input dataframe with new columns for nearest neighbor id (nn_id
),
bearing angle (bangl
), and distance (nnd
).
If add_coords
is TRUE, the columns nnx
and nny
are added.
Author
Marina Papadopoulou m.papadopoulou.rug@gmail.com