Re-cut a spatial cluster tree (scl) at a different number of clusters.

scl_recluster(scl, ncl, shortest = TRUE, quiet = FALSE)

Arguments

scl

An scl object returned from scl_redcap.

ncl

Desired number of clusters. See description of `ncl_iterate` parameter for conditions under which actual number may be less than this value.

shortest

If TRUE, the dmat is interpreted as distances such that lower values are preferentially selected; if FALSE, then higher values of dmat are interpreted to indicate stronger relationships, as is the case for example with covariances.

quiet

If `FALSE` (default), display progress information on screen.

Value

Modified scl object in which tree is re-cut into ncl clusters.

See also

Other clustering_fns: scl_full(), scl_redcap()

Examples

n <- 100
xy <- matrix (runif (2 * n), ncol = 2)
dmat <- matrix (runif (n ^ 2), ncol = n)
scl <- scl_redcap (xy, dmat, ncl = 4)
plot (scl)

scl <- scl_recluster (scl, ncl = 5)
plot (scl)