Description Usage Arguments Value Examples
point_spacing_2d
computes the avererage distance to the four nearest
samples in the mask domain. The number of nearest samples can be adjusted.
The returned object is a dataframe of regular grid points (as defined by the
input point pattern object) with column of distances. Distance is the mean
distance to the kn
nearest samples converted to a square grid sapcing:
distance = 2 * sqrt(mean_distance^2 / 2)
. If there are less than
kn
points in the point pattern, the distance is calculated on the
available samples.
1 | point_spacing_2d(points, nk = 4L)
|
points |
A point pattern object from package
|
nk |
Scalar number (default 4) of nearest points to use (>= 1). |
A dataframe with columns 'x', 'y', and 'distance' defining a grid of
points (as defined by the points
window). This can be used with
geom_raster
to vizualize point spacing.
1 2 3 4 5 6 7 | library(ggplot2)
dec <- polydeclust2d(samples$x, samples$y, mask = mask)
spacing <- point_spacing_2d(dec$ppp_mask)
ggplot() +
geom_raster(data = spacing, aes(x, y, fill = distance)) +
geom_point(data = samples, aes(x, y)) +
scale_fill_viridis_c()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.