Calculates the distances between a set of points and target locations. It identifies the nearest target for each point and checks if the distance is within a specified radius. If a target is found within the radius, its index and distance are returned; otherwise, -1 is returned for both.
nearestTarget(data, targets, r)A data frame with two columns:
Index of the nearest target for each point. If no target is found within the radius, this will be -1.
Distance to the nearest target. If no target is found within the radius, this will be -1.
An object of class `trajectory` containing a collection of points with coordinates.
A matrix or data frame containing the coordinates of the target locations with rows representing targets.
A numeric value specifying the radius within which to consider targets.