crossdist.lpp: Pairwise distances between two point patterns on a linear...

View source: R/crossdistlpp.R

crossdist.lppR Documentation

Pairwise distances between two point patterns on a linear network

Description

Computes the distances between pairs of points taken from two different point patterns on the same linear network.

Usage

  ## S3 method for class 'lpp'
crossdist(X, Y, ..., method="C", check=TRUE)

Arguments

X, Y

Point patterns on a linear network (objects of class "lpp"). They must lie on the same network.

...

Ignored.

method

String specifying which method of calculation to use when the network data use the non-sparse representation. Values are "C" and "interpreted".

check

Logical value specifying whether to check that X and Y are defined on the same network. Default is check=TRUE. Setting check=FALSE will save time, but should only be used if it is certain that the two networks are identical.

Details

Given two point patterns on a linear network, this function computes the distance from each point in the first pattern to each point in the second pattern, measuring distance by the shortest path along the network.

This is a method for the generic function crossdist for the class of point patterns on a linear network (objects of class "lpp").

This function expects two point pattern objects X and Y on the same linear network, and returns the matrix whose [i,j] entry is the shortest-path distance from X[i] to Y[j].

If two points cannot be joined by a path, the distance between them is infinite (Inf).

The argument method is not normally used. It is retained only for developers to check the validity of the software.

Value

A matrix whose [i,j] entry is the distance from the i-th point in X to the j-th point in Y. Matrix entries are nonnegative numbers or infinity (Inf).

Algorithms and accuracy

Distances are accurate within the numerical tolerance of the network, summary(X)$toler.

For network data stored in the non-sparse representation described in linnet, then pairwise distances are computed using the matrix of path distances between vertices of the network, using R code if method = "interpreted", or using C code if method="C" (the default).

For networks stored in the sparse representation, the argument method has no effect, and the distances are computed using an efficient C algorithm.

Author(s)

\adrian

.

See Also

crossdist, crossdist.ppp, pairdist, nndist

Examples

   v <- split(chicago)
   X <- v$cartheft
   Y <- v$burglary
   d <- crossdist(X, Y)
   d[1:3,1:4]

spatstat.linnet documentation built on Sept. 20, 2024, 5:06 p.m.