0

I have a code like this:

nf<- read.csv("test2.csv")#test 2 is containing 79 rows(name of documents) and one column of text as containing document.
corpus <- Corpus(VectorSource(nf$segment))
corpus <- tm_map(corpus, tolower)
corpus <- tm_map(corpus, removeNumbers)
corpus <- tm_map(corpus, removePunctuation)
corpus <- tm_map(corpus, function(x) removeWords(x, stopwords("english")))
corpus <- tm_map(corpus, function(x) removeWords(x,"shall"))
corpus <- tm_map(corpus, function(x) removeWords(x,"will"))
corpus <- tm_map(corpus, function(x) removeWords(x,"can"))
corpus <- tm_map(corpus, function(x) removeWords(x,"could"))
corpus  <- tm_map(corpus, stemDocument, language = "english") 
td.mat <- as.matrix(TermDocumentMatrix(corpus))
dist.mat <- dist(t(as.matrix(td.mat)))

ft <- hclust(dist.mat, method="ward.D2")
plot(ft)

my dendrogram

I have cluster dendrogram from documents. if I cut I in height=50 .how I can have the terms in this level?

lida
  • 1
  • 3
  • You may want to look at this: https://stackoverflow.com/questions/25452472/extract-labels-membership-classification-from-a-cut-dendrogram-in-r-i-e-a-c – akash87 Jul 16 '18 at 13:55
  • thanks but It gives documents only. I want to gain terms in every level of dendrogram. – lida Jul 16 '18 at 20:14

0 Answers0