... table()
하지만 방법을 시도했다. 각 요소가 다른 클러스터 인 목록을 리턴합니다.
hc <- hclust(dist(USArrests), "ave")
ct <- cutree(hc, k=3)
당신은 단지 회원 이름하려는 경우 :
split(USArrests, ct)
# $`1`
# Murder Assault UrbanPop Rape
# Alabama 13.2 236 58 21.2
# Alaska 10.0 263 48 44.5
# Arizona 8.1 294 80 31.0
# [...]
# $`2`
# Murder Assault UrbanPop Rape
# Arkansas 8.8 190 50 19.5
# Colorado 7.9 204 78 38.7
# Georgia 17.4 211 60 25.8
# [...]
# $`3`
# Murder Assault UrbanPop Rape
# Connecticut 3.3 110 77 11.1
# Hawaii 5.3 46 83 20.2
# Idaho 2.6 120 54 14.2
# [...]
:
split(names(ct), ct)
# $`1`
# [1] "Alabama" "Alaska" "Arizona" "California"
# [5] "Delaware" "Florida" "Illinois" "Louisiana"
# [9] "Maryland" "Michigan" "Mississippi" "Nevada"
# [13] "New Mexico" "New York" "North Carolina" "South Carolina"
# $`2`
# [1] "Arkansas" "Colorado" "Georgia" "Massachusetts"
# [5] "Missouri" "New Jersey" "Oklahoma" "Oregon"
# [9] "Rhode Island" "Tennessee" "Texas" "Virginia"
# [13] "Washington" "Wyoming"
# $`3`
# [1] "Connecticut" "Hawaii" "Idaho" "Indiana"
# [5] "Iowa" "Kansas" "Kentucky" "Maine"
# [9] "Minnesota" "Montana" "Nebraska" "New Hampshire"
# [13] "North Dakota" "Ohio" "Pennsylvania" "South Dakota"
# [17] "Utah" "Vermont" "West Virginia" "Wisconsin"
또는 당신은 클러스터 분할 원본 데이터를 원하는 경우