{R version 3.1.2}
I am trying to make a function that can take the name of any txt file in the working directory and automatically read it, remove stop words, and create a word cloud. Here is the code so far:
word_cloud <- function(x){
    fileName <- paste("./", x , sep="")
    txt = readLines(fileName, warn=FALSE)
    myCorpus = Corpus(VectorSource(txt))
    myCorpus = tm_map(myCorpus, tolower)
    myCorpus = tm_map(myCorpus, removePunctuation)
    myCorpus = tm_map(myCorpus, removeNumbers)
    myCorpus = tm_map(myCorpus, removeWords, stopwords("english"))
    myDTM = TermDocumentMatrix(myCorpus, control = 
                                            list(minWordLength = 1))
    m = as.matrix(myDTM)
    v = sort(rowSums(m), decreasing = TRUE)
    set.seed(4363)
    wordcloud(names(v), v, min.freq = 50)
}          
When it runs down to the line where it assigns myDTM, it throws the error,
"Error in UseMethod("meta", x) : no applicable method for 'meta' applied to an object of class "character""
and the warning:
"In addition: Warning message: In mclapply(unname(content(x)), termFreq, control) : all scheduled cores encountered errors in user code"
What's going on here?