data(iris)
iris <- as.matrix(iris[, 1:4])
res <- dbscan(iris, eps = .7, minPts = 5)
res
ncluster(res)
nnoise(res)
nobs(res)
# the functions also work with kmeans and other clustering algorithms.
cl <- kmeans(iris, centers = 3)
ncluster(cl)
nnoise(cl)
nobs(res)
Run the code above in your browser using DataLab