Hierarchical Clustering in R


I am using hierarchical clustering in the Rstudio software with a database that involves several properties (farms). I used the following codes:

library (readxl)
B1 <- read_excel ("C: / Users / Jovani Souza / Google Drive / Google Drive PC / Work / Clustering / ITAI database / B1.xlsx")
A <-scale (B1)
d <-dist (B1)
fit.ward <-hclust (d, method = "ward")
plot (fit.ward, hang = -1, cex = .8, main = "Ward Linkage Clustering")

I am able to plot the graph, which shows the dendrogram. But would it be possible to show the results in a table, so that it is possible to view the properties that are within each cluster?

Thank you!!

I cannot answer your question, just wanted to point out, that you are not using A - the data in dist() is not scaled. Don't know if that's your intention.

Sorry, but I didn't understand what you said. Could you tell me more about this question of scale? Use another formula?

Thanks again.


Thanks for the answer.

I did some tests yesterday and used the following formula:

write.table (clusters, "" C: / Users / Jovani Souza / Google Drive / Google Drive PC / Work / Clustering / ITAI Database / mydata.txt ", sep =" \ t ")

The data were presented in table form, so I was able to see all the properties and in which cluster this property is.


see comments inside your code. You do scale your data in the 4th line, but you are not using the scaled version of your data but the original one (B1) for your distance matrix.

It is true. Thank you very much for helping me.

The results were quite different.

Thanks again.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.