assign_nn: assign_nn

View source: R/assign_nn.R

assign_nnR Documentation

assign_nn

Description

Add nearest neighbor information by osrm route service

Usage

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


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


RichDeto/EPP documentation built on May 5, 2022, 10:23 p.m.