My task is to apply LDA on the dataset of amazon reviews and get 50 topics
I have extracted the review text in a vector and now I am trying to apply LDA
I have created the dtm
matrix <- create_matrix(dat, language="english", removeStopwords=TRUE, stemWords=FALSE, stripWhitespace=TRUE, toLower=TRUE)
<<DocumentTermMatrix (documents: 100000, terms: 174632)>>
Non-/sparse entries: 4096244/17459103756
Sparsity : 100%
Maximal term length: 218
Weighting : term frequency (tf)
but when I try to do this I get the following error:
lda <- LDA(matrix, 30)
Error in LDA(matrix, 30) :
Each row of the input matrix needs to contain at least one non-zero entry
Searched for some solutions and used slam to
matrix1 <- rollup(matrix, 2, na.rm=TRUE, FUN = sum)
still getting the same error
I am very new to this can someone help me or suggest me some reference to study about this.It will be very helpful
There are no empty rows in my original matrix and it contains only one column that contain reviews