DocumentTermMatrix() return 0 terms in tm package

爱⌒轻易说出口 提交于 2019-12-11 14:51:15

问题


I have an object like that:

str(apps)
 chr [1:17517] "35 44 33 40 33 40 44 38 33 37 37" ...

In each row, the number is separated by space.

corpus<-Corpus(VectorSource(apps))
dtm<-DocumentTermMatrix(corpus)
str(dtm)
List of 6
 $ i       : int(0) 
 $ j       : int(0) 
 $ v       : num(0) 
 $ nrow    : int 17517
 $ ncol    : int 0
 $ dimnames:List of 2
  ..$ Docs : chr [1:17517] "1" "2" "3" "4" ...
  ..$ Terms: NULL
 - attr(*, "class")= chr [1:2] "DocumentTermMatrix" "simple_triplet_matrix"
 - attr(*, "weighting")= chr [1:2] "term frequency" "tf"

I found that the Terms is NULL. I don't know exactly the data structure for DocumentTermMatrix(),I just following this thread Document-Term-Matrix of tm Package in R . Anyone can help solve it? Thanks

来源:https://stackoverflow.com/questions/31932387/documenttermmatrix-return-0-terms-in-tm-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!