a guest Aug 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # As the initial centroids are defined randomly,
- # we define a seed for purposes of reprodutability
- # Let's remove the column with the mammals' names, so it won't be used in the clustering
- input <- all.mammals.milk.1956[,2:6]
- # The nstart parameter indicates that we want the algorithm to be executed 20 times.
- # This number is not the number of iterations, it is like calling the function 20 times and then
- # the execution with lower variance within the groups will be selected as the final result.
- kmeans(input, centers = 3, nstart = 20)
RAW Paste Data