point_spacing_2d: Calculate 2D Point Sample Spacing.

Description Usage Arguments Value Examples

View source: R/polygonal-2d.R

Description

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.

Usage

1

Arguments

points

A point pattern object from package spatstat.

nk

Scalar number (default 4) of nearest points to use (>= 1).

Value

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.

Examples

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

truemoid/declustr documentation built on May 20, 2019, 9:57 a.m.