e2dist: Compute the distance between trap locations and animal...

e2distR Documentation

Compute the distance between trap locations and animal activity centers.

Description

A fast alternative to using 'for' loops for computing a distance matrix.

Usage

e2dist(x, y)

Arguments

x

Coordinates of animal activity centers. A matrix with one row for each animal and 2 columns for easting and northing.

y

Coordinates of trap locations. A matrix with one row for each trap and 2 columns for easting and northing.

Value

A distance matrix with one row per animal and one column per trap.

Author(s)

Andy Royle, aroyle@usgs.gov

Examples


nAnimals <- 10
nTraps <- 5
activity.centers <- cbind(runif(nAnimals), runif(nAnimals))
trap.locs <- cbind(seq(0, 1, length=nTraps), seq(0, 1, length=nTraps))
Dmat<- e2dist(activity.centers, trap.locs)



jaroyle/oSCR documentation built on Sept. 23, 2023, 12:46 p.m.