Learn R Programming

BioTrajectory (version 1.1.0)

distanceToTarget: Calculates distances to a target point

Description

Given a dataset of points, it computes the Euclidean distances from each point to a specified target point. The function also identifies contiguous segments of points that fall within a specified radius around the target.

Usage

distanceToTarget(data, target, targetRadious = 0)

Value

A list containing:

distance

A numeric vector of distances from each point in `data` to the `target`.

r

A list with two components: `start`, indicating the starting indices of contiguous segments of points within the target radius, and `length`, indicating the lengths of these segments.

target_radious

The radius around the target point.

Arguments

data

An object of class `trajectory` containing a collection of points with coordinates.

target

A numeric vector representing the coordinates of the target point.

targetRadious

A numeric value indicating the radius around the target point. Points within this radius are considered to be close to the target. Default is 0.