[R] Error on Text Mining for WordCloud

Boris Steipe boris.steipe at utoronto.ca
Sun Feb 14 03:59:00 CET 2016


That looks to me like a rather basic misunderstanding of how R syntax works. You might want to have a look at the documentation of as.character(), and read about its return value. Then note that you are not assigning the return value to anything. 

To wit:

a <- 5
mode(a)

as.character(a)
mode(a) # simply calling as.character() does not change a!

a <- as.character(a)
mode(a)  # there we go.



B.

On Feb 12, 2016, at 2:33 PM, SHIVI BHATIA <shivi.bhatia at safexpress.com> wrote:

> Dear Team, 
> 
> 
> 
> Please suggest on the below error while I am building a WordCloud on R for
> one of user twitter account:
> 
> 
> 
> Error in UseMethod("TermDocumentMatrix", x) : 
> 
>  no applicable method for 'TermDocumentMatrix' applied to an object of
> class "c('double', 'numeric')"
> 
> 
> 
> 
> 
> I have tried searching a lot on this issue however don't get much help. 
> 
> 
> 
> Used Tm package and corpus. Below are the expression below:
> 
> 
> 
> as.character(nwCorp1<- tm_map(corpuss1, removeNumbers))
> 
> as.character(nwCorp1<- tm_map(nwCorp1, removePunctuation))
> 
> as.character(nwCorp1<- tm_map(nwCorp1,PlainTextDocument))
> 
> as.character(nwCorp1<- tm_map(nwCorp1, removeWords,stopwords("english")))
> 
> as.character(nwCorp1<- tm_map(nwCorp1,stripWhitespace))
> 
> as.character(nwCorp1)
> 
> 
> 
> dtm11<- DocumentTermMatrix(nwCorp1)
> 
> dtm11
> 
> dtm12<- as.matrix(dtm11)
> 
> dtm12
> 
> frequency<- colSums(dtm12)
> 
> 
> 
> 
> 
> Thanks, Shivi
> 
> Mb: 9891002021
> 
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list