st_sd_distance {sfcentral} | R Documentation |
Standard deviation distance calculator
Description
Calculate the spatial deviaction distance from a points sf dataset.
Usage
st_sd_distance(.x, centre = NULL, weights = NULL, ...)
## S3 method for class 'sfg'
st_sd_distance(.x, centre = NULL, weights = NULL, ...)
## S3 method for class 'sf'
st_sd_distance(.x, centre = NULL, weights = NULL, ...)
## S3 method for class 'sfc'
st_sd_distance(.x, centre = NULL, weights = NULL, ...)
Arguments
.x |
sf points 2D or 3D |
centre |
One central point of class sf, sfc, numeric
(length 2), matrix (2 col, 1 row), data.frame (2 col, 1 row),
or list (length 2). Default |
weights |
Numeric. Same length as number of points in |
... |
other parameters for |
Value
A sf "POLYGON"
with atributes:
-
radius
(standard deviation distance) -
area
surrounding, -
perimeter
, -
center
coordinates, -
weigted
indicator if weights were used or not in the calculaton.
Author(s)
Gabriel Gaona
Examples
requireNamespace("ggplot2", quietly = TRUE)
library(sf, quietly = TRUE)
library(ggplot2)
bbx <- matrix(c(697047,9553483,
696158,9560476,
700964,9561425,
701745,9555358),
byrow = TRUE,
ncol = 2)
bbx <- st_multipoint(bbx)
bbx <- st_cast(bbx,"POLYGON")
bbx <- st_sfc(bbx, crs = 31992)
set.seed(1234)
points <- st_sf(geometry = st_sample(bbx, 100))
SDD <- st_sd_distance(points)
ggplot() +
geom_sf(data = SDD, fill = NA, color = "darkolivegreen") +
geom_sf(data = points, color = "steelblue", size = 0.5)
[Package sfcentral version 0.1.0 Index]