get.distance.matrix: Build distance matrix from XY coordinates

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function builds the pairwise distance matrix from vectors of XY coordinates and associated names.

Usage

1

Arguments

x

vector giving X coordinates

y

vector giving Y coordinates

id

vector of names for each location

Value

a named matrix of pairwise distances among locations

Author(s)

John Giles

See Also

Other data synthesis: calc.prop.tot.trips(), calc.route.type(), calc.samp.size(), get.crossdist(), get.distance.class(), get.distance.counts(), get.district.names.xy(), get.district.pop(), get.duration.counts(), get.holidays(), get.sparse.mob.matrix(), get.stay.data(), get.subsamp(), get.xy.counts(), mob.data.array(), parse.longform()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Some XY coords in decimal degrees
xy <- data.frame(x=rnorm(10, 100, 1), 
                 y=rnorm(10, 20, 1),
                 id=LETTERS[1:10])

D <- get.distance.matrix(x=xy[,1],
                         y=xy[,2],
                         id=xy[,3])

see(D)
see(D*111.35) # in km

gilesjohnr/hmob documentation built on Aug. 8, 2020, 1:26 a.m.