R-package 'TT' documenttermmatrix get Error

Source: Internet
Author: User

> DTM <-documenttermmatrix (corpus)
Error: not all inherits (Doc, "textdocument") are true.

Solution:

It seems this wowould have worked just fine inTM 0.5.10But changes inTM 0.6.0Seems to have broken it. The problem is that the functionsTolowerAndTrimWon't necessarily return textdocuments (it looks like the older version may have automatically done the conversion). They instead return characters and the documenttermmatrix isn't sure how to handle a corpus of characters.

So you cocould change

 
Corpus_clean <-tm_map (news_corpus, content_transformer (tolower ))

Or you can run

 
Corpus_clean <-tm_map (corpus_clean, plaintextdocument)

After all of your non-standard transformations (those not inGettransformations ()) Are done and just before you create the documenttermmatrix. That shoshould make sure all of your data is in plaintextdocument and shocould make documenttermmatrix happy.

From: http://stackoverflow.com/questions/24191728/documenttermmatrix-error-on-corpus-argument

R-package 'TT' documenttermmatrix get Error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.