Measures of isolation and mean isolation to a set of points in
space. isolation()
creates random points in a landscape and calculates
the nearest neighbor distance from each of them to another set
of points passed as input, x
. mean_isolation()
calculates the
average isolation calculated through isolation()
.
Arguments
- x
[data.frame]
data.frame
with (x,y) coordinates in the columns.- n_rand
[numeric(1)=100]
Number of random points to be created in space, to compute the distance tox
.- ext
[numeric(x)=c(0,1)]
Extent of the space within which the random positions should be created c(x or ymin, x or ymax).- lonlat
[logical(1)=FALSE]
Whether the distance between points should be calculated in an WGS ellipsoid (lonlat = TRUE
) or on a plane (lonlat = FALSE
). Seeraster::pointDistance()
for more details.
Value
isolation()
returns the distance from each random point to
the nearest neighbor point in x
. mean_isolation()
returns the average
nearest neighbor distance from all random positions to the points in
x
.
Details
So far the function only works for a square landscape. In the future we can implement that for polygons or rasters with masks or null cells if necessary, in an approach similar to set_points_sample.
Examples
pts <- set_points(n_features = 100, method = "random", centers = 1, width = 0.1)[[1]]
isolation(pts)
#> [1] 0.033167001 0.079021831 0.024568096 0.034147079 0.010348466 0.030397813
#> [7] 0.069196720 0.011042546 0.055567046 0.032949514 0.077290656 0.018778862
#> [13] 0.025538219 0.045757015 0.082149216 0.032112792 0.106723125 0.014723639
#> [19] 0.013651075 0.063095853 0.072796343 0.054478787 0.044551459 0.145212184
#> [25] 0.050304188 0.042728442 0.067125453 0.054768245 0.044984048 0.028007031
#> [31] 0.037386239 0.013610036 0.087046947 0.028626245 0.014684346 0.072461127
#> [37] 0.050310098 0.108930960 0.026432366 0.008464251 0.053887644 0.013980185
#> [43] 0.032694774 0.030619359 0.027011358 0.048346788 0.049658406 0.050250720
#> [49] 0.093440515 0.076491984 0.081663350 0.038446584 0.125606323 0.076623891
#> [55] 0.055572226 0.050687024 0.077330360 0.030243342 0.086041379 0.101049524
#> [61] 0.095805188 0.066232435 0.028841065 0.023352805 0.015862838 0.056711365
#> [67] 0.099956375 0.041117797 0.051588718 0.044968457 0.076112292 0.020072805
#> [73] 0.083093672 0.063703971 0.022259208 0.043584831 0.041791169 0.034992279
#> [79] 0.060737607 0.045709298 0.027151109 0.083325449 0.040933479 0.068230323
#> [85] 0.067780785 0.073767269 0.027853972 0.048333647 0.064493699 0.068992653
#> [91] 0.034501344 0.061260372 0.028856658 0.073886793 0.015266428 0.059521381
#> [97] 0.068605446 0.050966492 0.097649222 0.030262465 0.027657122
mean_isolation(pts)
#> [1] 0.04972765