Takes XY coordinates of two sets of locations and returns cross distance for all entries.
get_crossdist(xy1, xy2, id1 = NULL, id2 = NULL)
xy1 | two column matrix of XY coordinates for first group |
---|---|
xy2 | two column matrix of XY coordinates for second group |
id1 | optional names for first group |
id2 | optional names for second group |
numeric scalar or vector
Other data synthesis:
get_distance_matrix()
,
get_mob_matrix()
,
get_stay_data()
John Giles
# Some XY coords in decimal degrees xy1 <- data.frame(x=rnorm(3, -90, 1), y=rnorm(3, 30, 1), id=LETTERS[1:3]) xy2 <- data.frame(x=rnorm(5, -90, 1), y=rnorm(5, 35, 1), id=LETTERS[4:8]) D <- get_crossdist(xy1=xy1[,1:2], xy2=xy2[,1:2], id1=xy1[,3], id2=xy2[,3]) D#> destination #> origin D E F G H #> A 5.816628 4.685571 7.208011 6.189143 6.928941 #> B 5.366823 4.439471 6.869588 5.842702 6.498575 #> C 6.388676 6.123250 8.288208 7.260867 7.579013