Learn R Programming

tbart (version 1.0)

mink.dists: Minkowski distances from a Spatial* or Spatial*DataFrame object

Description

Minkowski distances from a Spatial* or Spatial*DataFrame object

Usage

mink.dists(swdf1, swdf2, pwr, scale, weight)

Arguments

swdf1
- First Spatial*DataFrame object
swdf2
- Second Spatial*DataFrame object (if omitted, defaults to the same value as swdf1)
pwr
- Minkowski exponent
scale
- allows re-scaling eg: value of 1000 means distances in km if coordinates of swdf1/swdf2 in meters.
weight
- weight for each element in swdf1 (the demand locations)

Value

Distance matrix (if swdf1 or swdf2 not SpatialPoints*, distances are based on points obtained from coordinates function)

Examples

Run this code
data(meuse)
coordinates(meuse) <- ~x+y
d1 <- mink.dists(meuse,pwr=1,scale=1000)   # Taxicab metric
d2 <- mink.dists(meuse,pwr=Inf,scale=1000) # Works for limiting case

Run the code above in your browser using DataLab