| ncluster | R Documentation |
Extract the number of clusters or the number of noise points for
a clustering. This function works with any clustering result that
contains a list element named cluster with a clustering vector. In
addition, nobs (see stats::nobs()) is also available to retrieve
the number of clustered points.
ncluster(object, ...)
nnoise(object, ...)
object |
a clustering result object containing a |
... |
additional arguments are unused. |
returns the number if clusters or noise points.
Other clustering functions:
dbscan(),
extractFOSC(),
hdbscan(),
jpclust(),
optics(),
sNNclust()
data(iris)
iris <- as.matrix(iris[, 1:4])
res <- dbscan(iris, eps = .7, minPts = 5)
res
ncluster(res)
nnoise(res)
nobs(res)
# the functions also work with kmeans and other clustering algorithms.
cl <- kmeans(iris, centers = 3)
ncluster(cl)
nnoise(cl)
nobs(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.