require(cluster)
# The Ruspini data set from the package "cluster""
x = as.matrix(ruspini)
# assign random weights to observations
w = sample(1:10,nrow(x),replace = TRUE)
# assign random clusters to observations
cl = sample(1:3,nrow(x),replace = TRUE)
#output the total WWCSS and WWCSS for each cluster for the cluster assignments
wwcss(x, cl, w, groupSum = TRUE)
Run the code above in your browser using DataLab