#read data data <- read.table("Mdata.txt", header=T) # complete-cluter c1 <- hclust(as.dist(1-cor(t(data))), method = "complete")#row-clustering c2 <- hclust(as.dist(1-cor(data)), method = "complete")#column-clustering plot(c1, hang=-1)#plot row-cluster plot(c2, hang=-1)#plot column-cluster # for HeatMap correlationDistanceTable <- as.dist(1-cor(as.matrix((data)))) # Convert HeatMap to PDF pdf(file="heatmap.pdf") heatmap (x=as.matrix(data),Colv=as.dendrogram(c2),Rowv=as.dendrogram(c1), distfun=correlationDistanceTable, hclustfun=function(x) hclust(correlationDistanceTable), cexRow=0.55, margins = c(6,10)) dev.off()