dists {trajectories} | R Documentation |
Calculate distances between two Tracks
objects
Description
Calculates a distance matrix with distances for each pair of tracks.
Usage
## S4 method for signature 'Tracks,Tracks'
dists(tr1, tr2, f, ...)
Arguments
tr1 |
An object of class |
tr2 |
An object of class |
f |
A function to calculate distances. Default is |
... |
Additional parameters passed to |
Details
f
can be any function applicable to a numerical vector or frechetDist.
Value
A matrix with distances between each pair of tracks or NA
if they don't overlap in time.
Examples
## example tracks
library(sp)
library(xts)
data(A3)
track2 <- A3
index(track2@time) <- index(track2@time) + 32
track2@sp@coords <- track2@sp@coords + 0.003
## create Tracks objects
tracks1 <- Tracks(list(A3, track2))
tracks2 <- Tracks(list(track2, A3))
## calculate distances
## Not run:
dists(tracks1, tracks2)
dists(tracks1, tracks2, sum)
dists(tracks1, tracks2, frechetDist)
## End(Not run)
[Package trajectories version 0.2-8 Index]