assign_nn | R Documentation |
Add nearest neighbor information by osrm route service
assign_nn(x, y, y.id = "id", k = 10, crs = 32721)
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"). |
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 |
pop_epp_nn <- assign_nn(x = pop_epp[1:20,], y = centers_epp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.