outliers_by_cluster | R Documentation |
Spatial outlier method based on the dbscan spatial clustering algorithm. User should run dbscan::kNNdistplot() first to get a reasonable value for eps. The dbscan algorithm clusters according to a nominal distance between points (eps) and minimum number of points per cluster (MinPts) and puts all points that don't neatly fit into a group into cluster zero. This method draws a polygon around the non-cluster-zero points, applies some edge corrections, and determines outlier status accordingly.
outliers_by_cluster( pts, eps = 0.25, MinPts = 5, tension = 0.5, buffer_size = 0.05 )
pts |
sf points |
eps |
parameter passed to dbscan, distance between neighboring points |
MinPts |
parameter passed to dbscan, min points per cluster |
tension |
(optional) value from 0 to 1 to control how tight polygon should wrap around points |
buffer_size |
(optional) buffer around exterior points, in coordinate units |
list with outlier status and sf polygon
get_alphahull_polygon()
Other outlier functions:
outliers_by_box()
,
outliers_by_circle()
,
outliers_by_density()
,
outliers_by_iforest()
,
outliers_by_polygon()
,
spatial_outliers()
data("pdx_breweries") pts <- pdx_breweries$geometry x <- outliers_by_cluster(pts) plot(pts) plot(pts[x[[1]]==-1], col="red", add=TRUE) plot(x[[2]], add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.