title: Error in match.fun(FUN) : argument "FUN" is missing, with no default
body: <p>I'm analyzing 500 tweets for to make a wordcloud in R. I use tweepy to retrieve the tweets of a particular topic and put them in .csv  file which then this R program I've posted below takes in.</p>
  
  <pre><code>library(tm)
  library(stringr)
  library(wordcloud)
  
  tweets &lt;- read.csv("./tweets.csv", stringsAsFactors = FALSE)
  
  nohandles &lt;- str_replace_all(tweets$text, "@\\w+", "")
  
  wordCorpus &lt;- Corpus(VectorSource(nohandles))
  wordCorpus &lt;- tm_map(wordCorpus, removePunctuation)
  wordCorpus &lt;- tm_map(wordCorpus, content_transformer(tolower))
  wordCorpus &lt;- tm_map(wordCorpus, wordLengths = c(0,Inf))
  wordCorpus &lt;- tm_map(wordCorpus, removeWords, stopwords("english"))
  wordCorpus &lt;- tm_map(wordCorpus, removeWords, c("amp", "2yo", "3yo", "4yo"))
  wordCorpus &lt;- tm_map(wordCorpus, stripWhitespace)
  pal &lt;- brewer.pal(9,"YlGnBu")
  pal &lt;- pal[-(1:4)]
  set.seed(123)
  wordcloud(words = wordCorpus, scale=c(5,0.1), max.words=100, random.order=FALSE,
            rot.per=0.35, use.r.layout=FALSE, colors=pal)
  
  
  tdm &lt;- TermDocumentMatrix(wordCorpus)
  tdm
  </code></pre>
  
  <p>This is what the terminal outputes:</p>
  
  <pre><code>Loading required package: NLP
  Loading required package: methods
  Loading required package: RColorBrewer
  Error in match.fun(FUN) : argument "FUN" is missing, with no default
  Calls: tm_map -&gt; tm_map.VCorpus -&gt; mclapply -&gt; lapply -&gt; match.fun
  Execution halted
  </code></pre>
  
  <p><strong>This is due to this line in the R script which helps it get large data:</strong>
  wordCorpus &lt;- tm_map(wordCorpus, wordLengths = c(0,Inf))</p>
  
  <p>Now this script works just fine for any twitter archive but doesn't for a csv file which I make using Python [python code posted below] (which gets data from twitter, I've havent posted the api code here but that goes without saying and works fine otherwise the csv file with the tweets wouldn't have been created)</p>
  
  <pre><code>csvFile = open('tweets.csv', 'a')
  csvWriter = csv.writer(csvFile)
  for tweet in tweepy.Cursor(api.search,
      q="obama",
      rpp=100,
      result_type="recent",
      include_entities=True,
      lang="en").items(500):
          print (tweet.text)
          analysis = TextBlob(tweet.text)
          print(analysis.sentiment)
          print("")
          csvWriter.writerow([tweet.text.encode('utf-8')])
  </code></pre>