Вопрос

I have successfully run the DBSCAN algorithm (here is the stripped down command):

results <- dbscan(data,MinPts=15, eps=0.01)

and plotted my clusters:

plot(results, data) 

results$cluster returns a list with numeric values. The value at each index reflects the cluster to which the original data in that index belongs:

[1] 0 1 2 1 0 0 2 1 0 0 0 1 2 0 2 0 2 0 0 1 2 0 2 2 0 1 2 0 1 0 1 0 2 0 0 0 1 1 0 1 2 0 0 0 1 0 0 1 1 0 1
[52] 0 2 2 0 0 1 2 2 0 2 1 0 0 0 1 0 1 0 0 0 0 0 1 1 0 1 0 2 2 2 2 2 0 0 0 0 0 2 1 2 1 0 2 0 0 1 1 1 0 0 1
[103] 2 1 1 0 1 0 1 1 0 0 0 0 1 2 0 0 1 1 1 1 0 0 0 1 0 0 2 2 1 1 0 1 2 1 0 0 1 0 1 2 0 0 2 0 0 2 2 2 2 0 1

However, how can I retrieve the values of the original data that is in each cluster? For example, how can I get all the values from the original data that are in cluster #2?

Это было полезно?

Решение

Okay, this should do the trick for, e.g., cluster #2:

data[results$cluster==2,]
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top