get_crossdist: Get distance matrix for two different set of coordinates

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

Takes XY coordinates of two sets of locations and returns cross distance for all entries.

Usage

1
get_crossdist(xy1, xy2, id1 = NULL, id2 = NULL)

Arguments

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

Value

numeric scalar or vector

Author(s)

John Giles

See Also

Other data synthesis: get_distance_matrix(), get_mob_matrix(), get_stay_data()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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

COVID-19-Mobility-Data-Network/mobility documentation built on Nov. 22, 2021, 12:17 a.m.