DocumentTermMatrix() return 0 terms in tm package

2019-09-04 04:22发布

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

0条回答
登录 后发表回答