 inspect (tdm)
<<TermDocumentMatrix (terms: 56, documents: 6)>>
Non-/sparse entries: 67/269
Sparsity           : 80%
Maximal term length: 13
Weighting          : term frequency (tf)
Sample             :
            Docs
Terms        1 2 3 4 5 6
  accept     1 0 0 0 0 0
  depict     1 0 0 0 0 0
  fiction    2 0 0 1 1 0
  film       2 0 0 1 1 2
  fulli      1 0 0 0 0 0
  genr       1 1 1 0 0 1
  mainstream 1 0 0 0 0 0
  often      0 0 0 0 2 0
  scienc     2 0 0 1 2 0
  specul     1 0 0 0 1 0
> frq <- colSums (as.matrix (tdm))
> length (frq)
[1] 6
> inspect (frq)
Error in UseMethod("inspect", x) : 
  no applicable method for 'inspect' applied to an object of class "c('double', 'numeric')"
> head (frq)
 1  2  3  4  5  6 
16 15  5 14 13 10 
> frq_ord <- order (frq)
> head (frq_ord)
[1] 3 6 5 4 2 1
> freqTerm <- removeSparseTerms (tdm, 0.4)
> inspect (freqTerm)
<<TermDocumentMatrix (terms: 2, documents: 6)>>
Non-/sparse entries: 8/4
Sparsity           : 33%
Maximal term length: 4
Weighting          : term frequency (tf)
Sample             :
      Docs
Terms  1 2 3 4 5 6
  film 2 0 0 1 1 2
  genr 1 1 1 0 0 1
> freqTerm <- removeSparseTerms (tdm, 0.6)
> inspect (freqTerm)
<<TermDocumentMatrix (terms: 4, documents: 6)>>
Non-/sparse entries: 14/10
Sparsity           : 42%
Maximal term length: 7
Weighting          : term frequency (tf)
Sample             :
         Docs
Terms     1 2 3 4 5 6
  fiction 2 0 0 1 1 0
  film    2 0 0 1 1 2
  genr    1 1 1 0 0 1
  scienc  2 0 0 1 2 0
