"Error: inherits(doc, "TextDocument") is not TRUE " while performing text analysis

r
text_analytics

#1

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™ #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