Q:

Why can not I use "TermDocumentMatrix"?

Why can not I use "TermDocumentMatrix"?
I used the following command to unify plural words in singular form, but I get an error.
crudeCorp <- tm_map(crudeCorp, gsub, pattern = "smells", replacement = "smell")
crudeCorp <- tm_map(crudeCorp, gsub, pattern = "feels", replacement = "feel")
crudeDtm <- TermDocumentMatrix(crudeCorp, control=list(removePunctuation=T))
Error in UseMethod("meta", x) : 
  no applicable method for 'meta' applied to an object of class "character"

How should I solve it?
1. Is there a command to change from singular to cleaning?
2. Is this command I used wrong?
I will attach the following code to the sentence processing and matrix.
library(tm)
library(XML)

crudeCorp<-VCorpus(VectorSource(readLines(file.choose())))

#(Eliminating Extra Whitespace) 
crudeCorp <- tm_map(crudeCorp, stripWhitespace)

#(Convert to Lower Case)

crudeCorp<-tm_map(crudeCorp, content_transformer(tolower))

# remove stopwords from corpus

crudeCorp<-tm_map(crudeCorp, removeWords, stopwords("english"))
myStopwords <- c(stopwords("english"), "can", "will","got","also","goes","get","much","since","way","even")
myStopwords <- setdiff(myStopwords, c("will","can"))
crudeCorp <- tm_map(crudeCorp, removeWords, myStopwords)

crudeCorp<-tm_map(crudeCorp,removeNumbers)

crudeCorp <- tm_map(crudeCorp, gsub, pattern = "smells", replacement = "smell")
crudeCorp <- tm_map(crudeCorp, gsub, pattern = "feels", replacement = "feel")

#-(Creating Term-Document Matrices)
crudeDtm <- TermDocumentMatrix(crudeCorp, control=list(removePunctuation=T))

example : my data
1. I'M HAPPY
2. how are you?
3. This apple is good
(skip)

A:

Whyn't use below code for stemming & Punctuation removal?
crudeCorp <- tm_map(crudeCorp, removePunctuation)
crudeCorp <- tm_map(crudeCorp, stemDocument, language = "english")  
crudeDtm  <- DocumentTermMatrix(crudeCorp)

Hope this helps!

