nstart=
x. How can its value be best determined to know how many attempts should be made to find the best centroids?
k2 <- kmeans(data, centers = 2, nstart = 25)
have a look at this one:
https://www.r-statistics.com/2013/08/k-means-clustering-from-r-in-action/
Is a small guide for that issue.
BR