powered by
This function calculates the x and y coordinates of a neighbor in the reference frame of the focal individual.
add_rel_pos_coords(data, focal_heading = c(0, 1))
The input dataframe with additional nnx (nearest neighbor x coordinate) and nny (nearest neighbor y coordinate) columns.
nnx
nny
Dataframe with the bearing angle and distance of each individual to specific neighbors. Column names must include: bangl, nnd.
The heading of the focal individual, default = c(0,1) for plotting neighbor heading north.
Marina Papadopoulou m.papadopoulou.rug@gmail.com
data <- data.frame( bangl = runif(25, 0, pi), nnd = runif(25) ) data <- add_rel_pos_coords(data)
Run the code above in your browser using DataLab