When I run my kmeans algorithm I get this error
Error in kmeans(dat[, -1], k) :
more cluster centers than distinct data points.
How can this error be fixed? I am 99% sure my data points are distinct. Here is my code
withinVar <- c()
for (k in 2:30) {
km <- kmeans(dat[, -1], k)
withinVar <- c(withinVar, km$tot.withinss)
}