isolation: Isolation and mean isolation of points in space

View source: R/isolation.R

isolationR Documentation

Isolation and mean isolation of points in space

Description

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().

Usage

isolation(x, n_rand = 100, ext = c(0, 1, 0, 1), lonlat = FALSE)

mean_isolation(x, n_rand = 100, ext = c(0, 1, 0, 1), lonlat = FALSE)

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 to x.

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). See raster::pointDistance() for more details.

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.

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.

Examples

pts <- set_points(n_features = 100, method = "random", centers = 1, width = 0.1)[[1]]
isolation(pts)
mean_isolation(pts)

NINAnor/oneimpact documentation built on June 14, 2025, 12:27 a.m.