@harry wrote:
I am currently studying the text analysis in R and while studying it I have performed all the preprocessing steps to built the model for text analysis but when I am trying to calculate the frequencies of the words I am getting the error.
library(tm) #packages for text analysis
library(SnowballC)
corpus=Corpus(VectorSource(tweets$Tweet)) #creating corpus
corpus=tm_map(corpus,tolower) #converting all uppercase letter to lower case letter
corpus=tm_map(corpus,removePunctuation) #removing the punctuation
corpus=tm_map(corpus,removeWords,c("apple",stopwords("english"))) # remove the stop words
corpus=tm_map(corpus,stemDocument) #remove the stemming
frequencies = DocumentTermMatrix(corpus) #calculate the frequencies of the words.
Error: inherits(doc, "TextDocument") is not TRUE
Posts: 1
Participants: 1