assign_nn: assign_nn

Description Usage Arguments Value Examples

View source: R/assign_nn.R

Description

Add nearest neighbor information by osrm route service

Usage

1
assign_nn(x, y, y.id = "id", k = 10, crs = 32721)

Arguments

x

sf object of source distance criteria or data.frame with "x" and "y" coordinates

y

sf object of destination distance criteria or data.frame with "x" and "y" coordinates

y.id

name of y variable for identification. Default "id"

k

numeric value for the near neighbor linear criteria, to reduce the computation for nearest neighbor by route

crs

Coordinate Reference Systems (CRS), used only if x or y are not sf . Default = "32721").

Value

x object with three new variables

nn_id

y.id of nearest neighbor

time

time by car to nearest neighbor in minutes

dist

distance by route to nearest neighbor in kilometers

Examples

1
pop_epp_nn <- assign_nn(x = pop_epp[1:20,], y = centers_epp)

EPP documentation built on Jan. 25, 2022, 5:07 p.m.