e2dist | R Documentation |
A fast alternative to using 'for' loops for computing a distance matrix.
e2dist(x, y)
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. |
A distance matrix with one row per animal and one column per trap.
Andy Royle, aroyle@usgs.gov
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.