add_rel_pos_coords {swaRmverse} | R Documentation |
Relative Position Coordinates
Description
This function calculates the x and y coordinates of a neighbor in the reference frame of the focal individual.
Usage
add_rel_pos_coords(data, focal_heading = c(0, 1))
Arguments
data |
Dataframe with the bearing angle and distance of each individual to specific neighbors. Column names must include: bangl, nnd. |
focal_heading |
The heading of the focal individual, default = c(0,1) for plotting neighbor heading north. |
Value
The input dataframe with additional nnx
(nearest neighbor x coordinate)
and nny
(nearest neighbor y coordinate) columns.
Author(s)
Marina Papadopoulou m.papadopoulou.rug@gmail.com
Examples
data <- data.frame(
bangl = runif(25, 0, pi),
nnd = runif(25)
)
data <- add_rel_pos_coords(data)
[Package swaRmverse version 0.1.0 Index]