Calculate intersample distances for a set of X-Y coordinates

Share:

Description

calc.dist calculates and stores the distance matrix for all X-Y pairs. It works on a dataset where the first two columns are x and y coordinates

Usage

1
calc.dist(datafile)

Arguments

datafile

a dataset where the first two columns are x and y coordinates. Further columns can contain observed variables for subsequent modeling; these are ignored here.

Details

datafile is a dataset where the first two columns are x and y coordinates. If data are distributed on only one dimension (i.e. along a linear transect) one of the columns should contain zeroes.

Value

a vector containing distances between each pair of samples in the input data

Author(s)

Kerrie Mengersen, Eric Lamb

References

Lamb, E. G., K. Mengersen, K. J. Stewart, U. Attanayake, and S. D. Siciliano. 2014. Spatially explicit structural equation modeling. Ecology 95:2434-2442.

See Also

make.covar

Examples

1
2
3
4
data=truelove
distdata<-truelove[c(1:60),]
distances<-calc.dist(distdata)
distances