Full spatially-constrained clustering.
scl_full(
xy,
dmat,
ncl,
linkage = "single",
shortest = TRUE,
nnbs = 6L,
boundary = NULL
)Rectangular structure (matrix, data.frame, tibble), containing coordinates of points to be clustered.
Structure (matrix, data.frame, tibble) containing distances or
equivalent metrics between all points in xy. If xy has n
rows, then dmat may either be square, with n rows and n
columns, or in long form, with three columns of (from, to,
value). In long form, from and to are either integer row
indices of xy or character values matching rownames (xy).
Values may be given for one direction of each pair only, and are then
mirrored; values for all pairs must be present.
Desired number of clusters. See description of `ncl_iterate` parameter for conditions under which actual number may be less than this value.
One of "single", "average", or
"complete". For covariance clustering, use shortest = FALSE;
"complete" linkage then uses the smallest connecting value between
clusters. As for scl_redcap, initial clusters are always formed from
spatially nearest neighbours; shortest and linkage determine
only how these are then merged according to dmat.
If TRUE, the dmat is interpreted as distances
such that lower values indicate stronger relationships, and the tree is cut
to minimise the within-cluster sum of squared deviations of dmat
values. If FALSE, then higher values of dmat are interpreted
to indicate stronger relationships, as is the case for example with
covariances, and the tree is cut to maximise the mean dmat value
within clusters. This parameter only affects how the tree is cut; it has no
effect on construction of the spanning tree, which is always based on
spatial distances.
Number of spatially nearest neighbours to be used in calculating
clustering trees, irrespective of shortest. Triangulation will be
used if nnbs <= 0. Ignored if boundary is given.
Optional boundary of the study region. If given, spatial
neighbours are taken from a constrained Delaunay triangulation of the points
within this boundary (requires the 'cdtr' package), so that no neighbour
edges cross outside it, for example across concavities in the region. May be
a two-column matrix or data frame of the vertices of a single ring, a list of
such rings (holes are recognised by nesting), or an 'sf' polygon or
multipolygon object. All points in xy must lie inside the boundary.
A object of class scl with tree containing the
clustering scheme, and xy the original coordinate data of the
clustered points. An additional component, tree_rest, enables the tree
to be re-cut to a different number of clusters via scl_recluster.
Other clustering_fns:
scl_recluster(),
scl_redcap()