When I using TM, I'm trying to show the TermDocumentMatrix with inspect(), the result is not all the matrix, just part of it.
I am really confused.
Here is the result of my TDM:
> tdm
<<TermDocumentMatrix (terms: 84, documents: 1)>>
Non-/sparse entries: 84/0
Sparsity : 0%
Maximal term length: 16
Weighting : term frequency (tf)
Here is the result of inspect():
> inspect(tdm)
<<TermDocumentMatrix (terms: 84, documents: 1)>>
Non-/sparse entries: 84/0
Sparsity : 0%
Maximal term length: 16
Weighting : term frequency (tf)
Sample :
Docs
Terms 1
“ 3
and 6
both 2
building 2
entrepreneurs 2
impacts 2
political 2
social 3
the 4
they 4
This is my R Version and the tm package:
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5
locale:
[1] zh_TW.UTF-8/zh_TW.UTF-8/zh_TW.UTF-8/C/zh_TW.UTF-8/zh_TW.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tm_0.7-1 NLP_0.1-10
loaded via a namespace (and not attached):
[1] compiler_3.4.0 parallel_3.4.0 tools_3.4.0 Rcpp_0.12.11 slam_0.1-40
Thanks for all your answers !
If you have a small matrix you can just typecast it to a matrix.
as.matrix(tdm)