distance_matrix | R Documentation |
Calculate the euclidian distances beween coordinates for all coordinates within the cutoff.
distance_matrix(x, y, cutoff, min_dist = NULL)
x |
Projected x coordinate |
y |
Projected y coordinate |
cutoff |
The distance cutoff |
min_dist |
The minimum distance to separate two nodes. If the coordinates for two nodes are identical, the min_dist must be assigned or an error is raised. Default is NULL i.e. to raise an error. |
dgCMatrix
## Generate a grid 10 x 10 and place one node in each cell ## separated by 100m. nodes <- expand.grid(x = (0:9) * 100, y = (0:9) * 100) plot(y ~ x, nodes) ## Define the cutoff to only include neighbors within 300m. d <- distance_matrix(x = nodes$x, y = nodes$y, cutoff = 300) ## View the first 10 rows and columns in the distance matrix d[1:10, 1:10]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.