distance.info {EgoCor}R Documentation

Pairwise distances of spatial coordinates

Description

A range of descriptive statistics on the distribution of the pairwise distances between observations.

Usage

distance.info(data)

Arguments

data

A data frame or matrix containing the x-coordinates in the first column and the y-coordinates in the second column. Additional columns are ignored.

Value

A list containing:

distmatrix

A matrix containing the pairwise Euclidean distances between all given locations.

distset

A vector containing the pairwise Euclidean distances. The elements equal the upper (or lower) triangle minus the diagonal of the distance matrix. If the input dataset has n rows, distset contains n(n-1)/2 distances.

distsummary

A summary containing the minimum, 1st quartile, median, mean, 3rd quartile and maximum of the distset.

maxdist

The maximal distance.

Moreover, the function prints a histogram of the pairwise distances saved in the list entry distset.

Examples

## Example 1
x = c(1,3,7,10,15)
y = c(5,19,8,3,11)
z = rnorm(5, mean = 20, sd = 40)
dataset = as.data.frame(cbind(x,y,z))
distance.info(data = dataset)

## Example 2
distance.info(birth)



[Package EgoCor version 1.2.0 Index]