powered by
Assigns observation to the nearest cluster center, using squared Euclidean distance.
assignCluster(X, centers)
matrix of observations
matrix of cluster centers
A vector of cluster labels
# NOT RUN { X <- matrix(rnorm(100*5), nrow=100, ncol=5) centers <- matrix(runif(3*5), nrow=3, ncol=5) cl <- assignCluster(X, centers) table(cl) # }
Run the code above in your browser using DataLab