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()
# 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 6.154946 5.143751 5.871394 5.160951 5.234703 #> B 3.546335 2.779082 3.693776 3.807070 3.219096 #> C 4.709391 3.677586 4.394623 3.757227 3.759515