1

I am using the LSA library in R and creating the TermDocumentMatrix after the lsa projection.However for the classification using RTextTools library for my TermDocumentMatrix it gives the following error:

container <- create_container(t(projected_train_matrix), givenData$sentiment, trainSize=1:20000, testSize=20001:25000,virgin=FALSE)

The projected matrix is fine but it gives the following error

Error in validObject(.Object) : invalid class “matrix_container” object: invalid object for slot "column_names" in class "matrix_container": got class "NULL", should be or extend class "vector"

On using the TermDocumentMtarix created by RtextTools function only, it is not giving any errors.

Rtextmatrix <- create_matrix(givenData$review, language="english", ngramLength=1,removeNumbers=TRUE,removePunctuation=TRUE,removeSparseTerms=0,removeStopwords=TRUE,stemWords=FALSE,stripWhitespace=TRUE,toLower=TRUE,weighting=tm::weightTf)

However I do need to do the LSA processing. So could anyone suggest what I can do to overcome this error.

humble_me
  • 331
  • 3
  • 12
  • 1
    It would help if you provided a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample data showing how you created all of your objects. – MrFlick Aug 05 '16 at 14:26

0 Answers0