R/silhouette.R

setGeneric("silhouette",
	function (x, ...)
		standardGeneric("silhouette")
)

setMethod("silhouette",
	signature(x = "VegsoupPartition"),
	function (x, ...) {
		if (getK(x) == 1)
			stop("meaningless with k = ", getK(x))
		
		res <- cluster::silhouette(partitioning(x), dist = as.dist(x, ...))
		rownames(res) <- rownames(x)
		return(res)
	}
)

Try the vegsoup package in your browser

Any scripts or data that you put into this service are public.

vegsoup documentation built on Feb. 24, 2021, 3 a.m.