I have a question after working with the results of the following question: Plotting a heatmap given a dendrogram and a distance matrix in R.
I have worked with the second answer, and I used the Mtcars dataset for it.
rd<-dist(mtcars)
rc<-hclust(rd)
cd<-dist(t(mtcars))
cc<-hclust(cd)
cutree(rc, k = 4) -> ctr ## the cars are split in 4 groups
cutree(cc, k = 2) -> ctc ## The collums names are split in 2 groups
What I will do is now choose which car is a good car for me. I don't know how I can do it, but I think about I like this: I tell R what I expect from the column clusters and R tell me which options I still have.
I hope that some of you can help me a little bit. I also know that you can do it without clustering etc, but I will do in future the same on a big dataset, and then do I need clustering.
hclustis telling you which cars are similar to each other based on all of the variables you provided. If you want to use the clusters for decision making, you need to first establish the selection criteria (i.e. X gas mileage, Y size, Z transmission type), cluster based on the selection criteria and then find the cluster closest to your desired criteria – Dave2e Oct 04 '19 at 15:23