I went through your query. I understand that you are trying to create a simple example for DocumnetTermMatrix. 

for(i in 1:10) {
dtmname<-paste("dtm", i, sep = " ")
nam<-paste("c", i, "_cleanset", sep = " ")
assign(dtmname, DocumentTermMatrix(nam))
}
 
However you are getting the below error: Error in UseMethod("TermDocumentMatrix", x) : no applicable method for "TermDocumentMatrix" applied to an object of class "character"

You need to feed the data in a particular format into DocumentTermmatrix.

I have rectified the code and it is working now. Please check:

for(i in 1:10) {
  dtmname<-paste("dtm", i, sep = " ")
  nam<-paste("c", i, "_cleanset", sep = " ")
  corpus<-Corpus(VectorSource(c(nam)))
  assign(dtmname, DocumentTermMatrix(corpus))
}
print(dtm)
x <- list(`dtm 1`,`dtm 2`,`dtm 3`,`dtm 4`,`dtm 5`,`dtm 6`,`dtm 7`,`dtm 8`,`dtm 9`,`dtm 10`)
for(i in 1:10) {
  print(i)
  print(x[i])
}

This way you should be able to feed in your data into DTM.

I hope this resolves your query. Please let me know if you need any further help.200866