갈루아의 반서재

Document-term matrix 를 행렬로 변환하고, 컬럼끼리 값을 합하여 출현빈도를 구할 수 있다.

> freq <- colSums(as.matrix(dtm))

> length(freq)

[1] 531

위의 freq 를 정렬함으로써, 출현 빈도가 가장 높은 term과 가장 낮은 term을 구할 수 있다. 

> ord <- order(freq)

> freq[head(ord)] // # Least frequent terms

     (sample @coordinator   @delighted         @she         @two      10,000. 

           1            1            1            1            1            1 

> freq[tail(ord)] // # most frequent terms

have will  you that  and  the 

  15   15   27   51   56   71 

> freq[tail(ord,10)] // 갯수 지정도 가능

  all   but draft  this  have  will   you  that   and   the 

   10    11    11    13    15    15    27    51    56    71