How can I get the data-points from the cluster with smallest within-variance in kmeans?

arkm25

New Member
I have a kmeans object
km <- kmeans(data, centers = k)

The values of the within cluster variances can be found in km$withinss, and the smallest one is min(km$withinss).

My question is how can I extract the data-points from this minimum cluster?

I tried data[km$withinss == min(km$withinss)], but it doesn't work.

trinker

ggplot2orBust
Can you make this minimally reproducible and add what data should be or a dummy example?