a silinfo object, which contains 'data' (original data), 'silinfo' (silhouette scores), and k (the input k vector)
Arguments
data
input data (a matrix or data frame)
k
a vector of candidate number of clusters
Author
Guangchuang Yu
Details
This function calculate the silhouette scores of each K (number of clusters).
The output object can be used to choose the best K (via summary() or autoplot() methods)
x <- nk(iris[,-5], 2:8)
summary(x)
# to visualize the average silhouete score (y axis) with k (x axis)autoplot(x)
# to visualize a PCA plot color by the choosing kautoplot(x, k=3)