data1<-data.matrix(newdata) # transforming the factor into different values data.use<-data1[,-c(1,2,3)] # leaving the value matrix
data.dist = dist(data.use) data.hclust = hclust(data.dist) #complete linkage is used #if I plot the following one, I have too large data set(rows`=9980), can not see clearly all the product names in graph plot(data.hclust,hang=-1,labels=newdata$Product,main='Default from hclust') #so I decide to see the part of dendrogram using hcd = as.dendrogram(data.hclust) plot(cut(hcd, h=5)$lower[[46]]) By this way I could be able to see the 46th branch of the dendrogram. but then I met the problem. In the selected branch, all product are expressed by the row numbers. How can I transform the row numbers into the names of products as newdata$Product. I have been struggling for long time. I can not find the better solution.Thanks a lot. Tammy [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.